Changed App Name To My Mind

This commit is contained in:
Alexander Davis
2017-03-31 02:42:43 +01:00
commit 7df41a6301
540 changed files with 295800 additions and 0 deletions

View File

@@ -0,0 +1,653 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 48;
objects = {
/* Begin PBXBuildFile section */
5F1198DA1E8B2B1E009485AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F1198D91E8B2B1E009485AA /* libz.tbd */; };
5F1198DC1E8B2B26009485AA /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F1198DB1E8B2B26009485AA /* libsqlite3.tbd */; };
5F26CDB11DDDDB42008452B2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F26CDB01DDDDB42008452B2 /* AppDelegate.swift */; };
5F26CDB31DDDDB42008452B2 /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F26CDB21DDDDB42008452B2 /* FirstViewController.swift */; };
5F26CDB51DDDDB42008452B2 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F26CDB41DDDDB42008452B2 /* SecondViewController.swift */; };
5F26CDB81DDDDB42008452B2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5F26CDB61DDDDB42008452B2 /* Main.storyboard */; };
5F26CDBA1DDDDB42008452B2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5F26CDB91DDDDB42008452B2 /* Assets.xcassets */; };
5F26CDC81DDDDB42008452B2 /* BCU_MindTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F26CDC71DDDDB42008452B2 /* BCU_MindTests.swift */; };
5F6362A21E8C63B7001EEFD9 /* AmazonAws in Resources */ = {isa = PBXBuildFile; fileRef = 5F6362A01E8C63B7001EEFD9 /* AmazonAws */; };
5F6362A31E8C63B7001EEFD9 /* Sdk in Resources */ = {isa = PBXBuildFile; fileRef = 5F6362A11E8C63B7001EEFD9 /* Sdk */; };
5F6362A61E8C63D4001EEFD9 /* AWSCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362A41E8C63D4001EEFD9 /* AWSCore.framework */; };
5F6362A71E8C63D4001EEFD9 /* AWSCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362A41E8C63D4001EEFD9 /* AWSCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F6362A81E8C63D4001EEFD9 /* AWSSNS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362A51E8C63D4001EEFD9 /* AWSSNS.framework */; };
5F6362A91E8C63D4001EEFD9 /* AWSSNS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362A51E8C63D4001EEFD9 /* AWSSNS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F6362AB1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362AA1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework */; };
5F6362AC1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362AA1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F6362AF1E8C63F2001EEFD9 /* AWSConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F6362AD1E8C63F2001EEFD9 /* AWSConfiguration.swift */; };
5F6362B01E8C63F2001EEFD9 /* AWSMobileClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F6362AE1E8C63F2001EEFD9 /* AWSMobileClient.swift */; };
5F6362B31E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362B11E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework */; };
5F6362B41E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362B11E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F6362B51E8C6668001EEFD9 /* AWSS3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362B21E8C6668001EEFD9 /* AWSS3.framework */; };
5F6362B61E8C6668001EEFD9 /* AWSS3.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362B21E8C6668001EEFD9 /* AWSS3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F6362B81E8C6675001EEFD9 /* AWSCognito.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362B71E8C6675001EEFD9 /* AWSCognito.framework */; };
5F6362B91E8C6675001EEFD9 /* AWSCognito.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362B71E8C6675001EEFD9 /* AWSCognito.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F6362BE1E8C67FB001EEFD9 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362BA1E8C67EC001EEFD9 /* Realm.framework */; };
5F6362BF1E8C67FB001EEFD9 /* Realm.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362BA1E8C67EC001EEFD9 /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F6362C01E8C67FB001EEFD9 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362BB1E8C67EC001EEFD9 /* RealmSwift.framework */; };
5F6362C11E8C67FB001EEFD9 /* RealmSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5F6362BB1E8C67EC001EEFD9 /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5F7360021E84A0640019C53C /* ForumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F7360011E84A0640019C53C /* ForumViewController.swift */; };
5F903E3F1E7AF0DD0097E0EA /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5F903E3E1E7AF0DD0097E0EA /* Launch.storyboard */; };
5FB9B2541E84ACA700CEC754 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FB9B2531E84ACA700CEC754 /* Login.swift */; };
5FB9B2561E84ACB500CEC754 /* SignUp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FB9B2551E84ACB500CEC754 /* SignUp.swift */; };
5FC858F51E846FF400AC42FD /* HelperLibrary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC858F01E846FF400AC42FD /* HelperLibrary.swift */; };
5FF972261E8DBE3C007AE280 /* OnboardingPager 23-27-53-633.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF972251E8DBE3C007AE280 /* OnboardingPager 23-27-53-633.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
5F26CDC41DDDDB42008452B2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5F26CDA51DDDDB42008452B2 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 5F26CDAC1DDDDB42008452B2;
remoteInfo = "BCU Mind";
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
5F1198D71E8B2AC4009485AA /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
5F6362B91E8C6675001EEFD9 /* AWSCognito.framework in Embed Frameworks */,
5F6362A71E8C63D4001EEFD9 /* AWSCore.framework in Embed Frameworks */,
5F6362A91E8C63D4001EEFD9 /* AWSSNS.framework in Embed Frameworks */,
5F6362AC1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework in Embed Frameworks */,
5F6362BF1E8C67FB001EEFD9 /* Realm.framework in Embed Frameworks */,
5F6362B41E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework in Embed Frameworks */,
5F6362C11E8C67FB001EEFD9 /* RealmSwift.framework in Embed Frameworks */,
5F6362B61E8C6668001EEFD9 /* AWSS3.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
5F1198D91E8B2B1E009485AA /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
5F1198DB1E8B2B26009485AA /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
5F26CDAD1DDDDB42008452B2 /* BCU Mind.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "BCU Mind.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5F26CDB01DDDDB42008452B2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5F26CDB21DDDDB42008452B2 /* FirstViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = "<group>"; };
5F26CDB41DDDDB42008452B2 /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = "<group>"; };
5F26CDB71DDDDB42008452B2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
5F26CDB91DDDDB42008452B2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5F26CDBE1DDDDB42008452B2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5F26CDC31DDDDB42008452B2 /* BCU MindTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "BCU MindTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
5F26CDC71DDDDB42008452B2 /* BCU_MindTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BCU_MindTests.swift; sourceTree = "<group>"; };
5F26CDC91DDDDB42008452B2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5F6362A01E8C63B7001EEFD9 /* AmazonAws */ = {isa = PBXFileReference; lastKnownFileType = folder; path = AmazonAws; sourceTree = "<group>"; };
5F6362A11E8C63B7001EEFD9 /* Sdk */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Sdk; sourceTree = "<group>"; };
5F6362A41E8C63D4001EEFD9 /* AWSCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AWSCore.framework; path = "BCU Mind/Sdk/Aws/AWSCore.framework"; sourceTree = "<group>"; };
5F6362A51E8C63D4001EEFD9 /* AWSSNS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AWSSNS.framework; path = "BCU Mind/Sdk/Aws/AWSSNS.framework"; sourceTree = "<group>"; };
5F6362AA1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AWSMobileHubHelper.framework; path = "BCU Mind/AmazonAws/AWSMobileHubHelper.framework"; sourceTree = "<group>"; };
5F6362AD1E8C63F2001EEFD9 /* AWSConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AWSConfiguration.swift; path = AmazonAws/AWSConfiguration.swift; sourceTree = "<group>"; };
5F6362AE1E8C63F2001EEFD9 /* AWSMobileClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AWSMobileClient.swift; path = AmazonAws/AWSMobileClient.swift; sourceTree = "<group>"; };
5F6362B11E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AWSCognitoIdentityProvider.framework; path = "BCU Mind/Sdk/Aws/AWSCognitoIdentityProvider.framework"; sourceTree = "<group>"; };
5F6362B21E8C6668001EEFD9 /* AWSS3.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AWSS3.framework; path = "BCU Mind/Sdk/Aws/AWSS3.framework"; sourceTree = "<group>"; };
5F6362B71E8C6675001EEFD9 /* AWSCognito.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AWSCognito.framework; path = "BCU Mind/Sdk/Aws/extras/AWSCognito.framework"; sourceTree = "<group>"; };
5F6362BA1E8C67EC001EEFD9 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Realm.framework; sourceTree = "<group>"; };
5F6362BB1E8C67EC001EEFD9 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RealmSwift.framework; sourceTree = "<group>"; };
5F7360011E84A0640019C53C /* ForumViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForumViewController.swift; sourceTree = "<group>"; };
5F903E3E1E7AF0DD0097E0EA /* Launch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Launch.storyboard; path = ../Launch.storyboard; sourceTree = "<group>"; };
5FB9B2531E84ACA700CEC754 /* Login.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Login.swift; sourceTree = "<group>"; };
5FB9B2551E84ACB500CEC754 /* SignUp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUp.swift; sourceTree = "<group>"; };
5FB9B2571E84B06600CEC754 /* BCU Mind.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "BCU Mind.entitlements"; sourceTree = "<group>"; };
5FC858F01E846FF400AC42FD /* HelperLibrary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelperLibrary.swift; sourceTree = "<group>"; };
5FF972251E8DBE3C007AE280 /* OnboardingPager 23-27-53-633.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OnboardingPager 23-27-53-633.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5F26CDAA1DDDDB42008452B2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5F6362AB1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework in Frameworks */,
5F6362C01E8C67FB001EEFD9 /* RealmSwift.framework in Frameworks */,
5F6362B31E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework in Frameworks */,
5F1198DC1E8B2B26009485AA /* libsqlite3.tbd in Frameworks */,
5F6362B51E8C6668001EEFD9 /* AWSS3.framework in Frameworks */,
5F1198DA1E8B2B1E009485AA /* libz.tbd in Frameworks */,
5F6362A61E8C63D4001EEFD9 /* AWSCore.framework in Frameworks */,
5F6362B81E8C6675001EEFD9 /* AWSCognito.framework in Frameworks */,
5F6362A81E8C63D4001EEFD9 /* AWSSNS.framework in Frameworks */,
5F6362BE1E8C67FB001EEFD9 /* Realm.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5F26CDC01DDDDB42008452B2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5F1198D81E8B2B1E009485AA /* Frameworks */ = {
isa = PBXGroup;
children = (
5FF972251E8DBE3C007AE280 /* OnboardingPager 23-27-53-633.swift */,
5F1198DB1E8B2B26009485AA /* libsqlite3.tbd */,
5F1198D91E8B2B1E009485AA /* libz.tbd */,
);
name = Frameworks;
sourceTree = "<group>";
};
5F26CDA41DDDDB42008452B2 = {
isa = PBXGroup;
children = (
5F6362B71E8C6675001EEFD9 /* AWSCognito.framework */,
5F6362B11E8C6668001EEFD9 /* AWSCognitoIdentityProvider.framework */,
5F6362B21E8C6668001EEFD9 /* AWSS3.framework */,
5F6362AA1E8C63E1001EEFD9 /* AWSMobileHubHelper.framework */,
5F6362A41E8C63D4001EEFD9 /* AWSCore.framework */,
5F6362A51E8C63D4001EEFD9 /* AWSSNS.framework */,
5F26CDAF1DDDDB42008452B2 /* BCU Mind */,
5F26CDC61DDDDB42008452B2 /* BCU MindTests */,
5F26CDAE1DDDDB42008452B2 /* Products */,
5F1198D81E8B2B1E009485AA /* Frameworks */,
);
sourceTree = "<group>";
};
5F26CDAE1DDDDB42008452B2 /* Products */ = {
isa = PBXGroup;
children = (
5F26CDAD1DDDDB42008452B2 /* BCU Mind.app */,
5F26CDC31DDDDB42008452B2 /* BCU MindTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
5F26CDAF1DDDDB42008452B2 /* BCU Mind */ = {
isa = PBXGroup;
children = (
5F6362BA1E8C67EC001EEFD9 /* Realm.framework */,
5F6362BB1E8C67EC001EEFD9 /* RealmSwift.framework */,
5FB9B2571E84B06600CEC754 /* BCU Mind.entitlements */,
5FC858F01E846FF400AC42FD /* HelperLibrary.swift */,
5F26CDBE1DDDDB42008452B2 /* Info.plist */,
5F903E3E1E7AF0DD0097E0EA /* Launch.storyboard */,
5F26CDB01DDDDB42008452B2 /* AppDelegate.swift */,
5F26CDB21DDDDB42008452B2 /* FirstViewController.swift */,
5F26CDB41DDDDB42008452B2 /* SecondViewController.swift */,
5F7360011E84A0640019C53C /* ForumViewController.swift */,
5F6362AD1E8C63F2001EEFD9 /* AWSConfiguration.swift */,
5F6362AE1E8C63F2001EEFD9 /* AWSMobileClient.swift */,
5F26CDB91DDDDB42008452B2 /* Assets.xcassets */,
5F6362A01E8C63B7001EEFD9 /* AmazonAws */,
5F6362A11E8C63B7001EEFD9 /* Sdk */,
5F26CDB61DDDDB42008452B2 /* Main.storyboard */,
5FB9B2551E84ACB500CEC754 /* SignUp.swift */,
5FB9B2531E84ACA700CEC754 /* Login.swift */,
);
path = "BCU Mind";
sourceTree = "<group>";
};
5F26CDC61DDDDB42008452B2 /* BCU MindTests */ = {
isa = PBXGroup;
children = (
5F26CDC71DDDDB42008452B2 /* BCU_MindTests.swift */,
5F26CDC91DDDDB42008452B2 /* Info.plist */,
);
path = "BCU MindTests";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
5F26CDAC1DDDDB42008452B2 /* BCU Mind */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5F26CDCC1DDDDB42008452B2 /* Build configuration list for PBXNativeTarget "BCU Mind" */;
buildPhases = (
5F26CDA91DDDDB42008452B2 /* Sources */,
5F26CDAA1DDDDB42008452B2 /* Frameworks */,
5F26CDAB1DDDDB42008452B2 /* Resources */,
5F1198B61E8B2A78009485AA /* ShellScript */,
5F1198D71E8B2AC4009485AA /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "BCU Mind";
productName = "BCU Mind";
productReference = 5F26CDAD1DDDDB42008452B2 /* BCU Mind.app */;
productType = "com.apple.product-type.application";
};
5F26CDC21DDDDB42008452B2 /* BCU MindTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5F26CDCF1DDDDB42008452B2 /* Build configuration list for PBXNativeTarget "BCU MindTests" */;
buildPhases = (
5F26CDBF1DDDDB42008452B2 /* Sources */,
5F26CDC01DDDDB42008452B2 /* Frameworks */,
5F26CDC11DDDDB42008452B2 /* Resources */,
);
buildRules = (
);
dependencies = (
5F26CDC51DDDDB42008452B2 /* PBXTargetDependency */,
);
name = "BCU MindTests";
productName = "BCU MindTests";
productReference = 5F26CDC31DDDDB42008452B2 /* BCU MindTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
5F26CDA51DDDDB42008452B2 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0810;
LastUpgradeCheck = 0820;
ORGANIZATIONNAME = "Alexander Davis";
TargetAttributes = {
5F26CDAC1DDDDB42008452B2 = {
CreatedOnToolsVersion = 8.1;
DevelopmentTeam = 28CC8SCVUN;
LastSwiftMigration = 0820;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Push = {
enabled = 1;
};
};
};
5F26CDC21DDDDB42008452B2 = {
CreatedOnToolsVersion = 8.1;
DevelopmentTeam = 28CC8SCVUN;
ProvisioningStyle = Automatic;
TestTargetID = 5F26CDAC1DDDDB42008452B2;
};
};
};
buildConfigurationList = 5F26CDA81DDDDB42008452B2 /* Build configuration list for PBXProject "BCU Mind" */;
compatibilityVersion = "Xcode 8.0";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 5F26CDA41DDDDB42008452B2;
productRefGroup = 5F26CDAE1DDDDB42008452B2 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
5F26CDAC1DDDDB42008452B2 /* BCU Mind */,
5F26CDC21DDDDB42008452B2 /* BCU MindTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
5F26CDAB1DDDDB42008452B2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5F26CDBA1DDDDB42008452B2 /* Assets.xcassets in Resources */,
5F26CDB81DDDDB42008452B2 /* Main.storyboard in Resources */,
5F6362A31E8C63B7001EEFD9 /* Sdk in Resources */,
5F6362A21E8C63B7001EEFD9 /* AmazonAws in Resources */,
5F903E3F1E7AF0DD0097E0EA /* Launch.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5F26CDC11DDDDB42008452B2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
5F1198B61E8B2A78009485AA /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/AWSCore.framework/strip-frameworks.sh\"";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5F26CDA91DDDDB42008452B2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5F26CDB51DDDDB42008452B2 /* SecondViewController.swift in Sources */,
5FB9B2541E84ACA700CEC754 /* Login.swift in Sources */,
5F26CDB11DDDDB42008452B2 /* AppDelegate.swift in Sources */,
5FB9B2561E84ACB500CEC754 /* SignUp.swift in Sources */,
5F6362AF1E8C63F2001EEFD9 /* AWSConfiguration.swift in Sources */,
5F7360021E84A0640019C53C /* ForumViewController.swift in Sources */,
5FF972261E8DBE3C007AE280 /* OnboardingPager 23-27-53-633.swift in Sources */,
5F6362B01E8C63F2001EEFD9 /* AWSMobileClient.swift in Sources */,
5F26CDB31DDDDB42008452B2 /* FirstViewController.swift in Sources */,
5FC858F51E846FF400AC42FD /* HelperLibrary.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5F26CDBF1DDDDB42008452B2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5F26CDC81DDDDB42008452B2 /* BCU_MindTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
5F26CDC51DDDDB42008452B2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 5F26CDAC1DDDDB42008452B2 /* BCU Mind */;
targetProxy = 5F26CDC41DDDDB42008452B2 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
5F26CDB61DDDDB42008452B2 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
5F26CDB71DDDDB42008452B2 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5F26CDCA1DDDDB42008452B2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
5F26CDCB1DDDDB42008452B2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
5F26CDCD1DDDDB42008452B2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "BCU Mind/BCU Mind.entitlements";
DEVELOPMENT_TEAM = 28CC8SCVUN;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/AmazonAws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/AmazonAws",
"$(SRCROOT)/**",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
);
INFOPLIST_FILE = "BCU Mind/Info.plist";
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "ADCMNetworks.BCU-Mind";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DDEBUG -D DEBUG";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
5F26CDCE1DDDDB42008452B2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "BCU Mind/BCU Mind.entitlements";
DEVELOPMENT_TEAM = 28CC8SCVUN;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/AmazonAws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/AmazonAws",
"$(SRCROOT)/**",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws",
"$(PROJECT_DIR)/BCU\\ Mind/Sdk/Aws/extras",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
"$(PROJECT_DIR)/BCU\\ Mind",
);
INFOPLIST_FILE = "BCU Mind/Info.plist";
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "ADCMNetworks.BCU-Mind";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "-DRELEASE -D RELEASE";
SWIFT_VERSION = 3.0;
};
name = Release;
};
5F26CDD01DDDDB42008452B2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = 28CC8SCVUN;
INFOPLIST_FILE = "BCU MindTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ADCMNetworks.BCU-MindTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BCU Mind.app/BCU Mind";
};
name = Debug;
};
5F26CDD11DDDDB42008452B2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = 28CC8SCVUN;
INFOPLIST_FILE = "BCU MindTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ADCMNetworks.BCU-MindTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BCU Mind.app/BCU Mind";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5F26CDA81DDDDB42008452B2 /* Build configuration list for PBXProject "BCU Mind" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5F26CDCA1DDDDB42008452B2 /* Debug */,
5F26CDCB1DDDDB42008452B2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5F26CDCC1DDDDB42008452B2 /* Build configuration list for PBXNativeTarget "BCU Mind" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5F26CDCD1DDDDB42008452B2 /* Debug */,
5F26CDCE1DDDDB42008452B2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5F26CDCF1DDDDB42008452B2 /* Build configuration list for PBXNativeTarget "BCU MindTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5F26CDD01DDDDB42008452B2 /* Debug */,
5F26CDD11DDDDB42008452B2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5F26CDA51DDDDB42008452B2 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:BCU Mind.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F26CDAC1DDDDB42008452B2"
BuildableName = "BCU Mind.app"
BlueprintName = "BCU Mind"
ReferencedContainer = "container:BCU Mind.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F26CDC21DDDDB42008452B2"
BuildableName = "BCU MindTests.xctest"
BlueprintName = "BCU MindTests"
ReferencedContainer = "container:BCU Mind.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F26CDAC1DDDDB42008452B2"
BuildableName = "BCU Mind.app"
BlueprintName = "BCU Mind"
ReferencedContainer = "container:BCU Mind.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F26CDAC1DDDDB42008452B2"
BuildableName = "BCU Mind.app"
BlueprintName = "BCU Mind"
ReferencedContainer = "container:BCU Mind.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F26CDAC1DDDDB42008452B2"
BuildableName = "BCU Mind.app"
BlueprintName = "BCU Mind"
ReferencedContainer = "container:BCU Mind.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>BCU Mind.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>5F26CDAC1DDDDB42008452B2</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>5F26CDC21DDDDB42008452B2</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,23 @@
//
// AWSConfiguration.swift
// MySampleApp
//
//
// Copyright 2017 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
// Source code generated from template: aws-my-sample-app-ios-swift v0.12
//
//
// This ServiceKey variable is used to determine which configuration to use.
// If it is a release build, it will use the Prod platform configuration.
// If it's not (debug build), it will default to the Devo (Sandbox) platform configuration.
#if RELEASE
let ServiceKey: String = "Prod";
#else
let ServiceKey: String = "Devo";
#endif

View File

@@ -0,0 +1,123 @@
//
// AWSMobileClient.swift
// MySampleApp
//
//
// Copyright 2017 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
// Source code generated from template: aws-my-sample-app-ios-swift v0.12
//
//
import Foundation
import UIKit
import AWSCore
import AWSMobileHubHelper
/**
* AWSMobileClient is a singleton that bootstraps the app. It creates an identity manager to establish the user identity with Amazon Cognito.
*/
class AWSMobileClient: NSObject {
// Shared instance of this class
static let sharedInstance = AWSMobileClient()
fileprivate var isInitialized: Bool
//Used for checking whether Push Notification is enabled in Amazon Pinpoint
static let remoteNotificationKey = "RemoteNotification"
fileprivate override init() {
isInitialized = false
super.init()
}
deinit {
// Should never be called
print("Mobile Client deinitialized. This should not happen.")
}
/**
* Configure third-party services from application delegate with url, application
* that called this provider, and any annotation info.
*
* - parameter application: instance from application delegate.
* - parameter url: called from application delegate.
* - parameter sourceApplication: that triggered this call.
* - parameter annotation: from application delegate.
* - returns: true if call was handled by this component
*/
func withApplication(_ application: UIApplication, withURL url: URL, withSourceApplication sourceApplication: String?, withAnnotation annotation: Any) -> Bool {
print("withApplication:withURL")
AWSIdentityManager.default().interceptApplication(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
if (!isInitialized) {
isInitialized = true
}
return false;
}
/**
* Performs any additional activation steps required of the third party services
* e.g. Facebook
*
* - parameter application: from application delegate.
*/
func applicationDidBecomeActive(_ application: UIApplication) {
print("applicationDidBecomeActive:")
}
/**
* Handles callback from iOS platform indicating push notification registration was a success.
* - parameter application: application
* - parameter deviceToken: device token
*/
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
AWSPushManager(forKey: ServiceKey).interceptApplication(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}
/**
* Handles callback from iOS platform indicating push notification registration failed.
* - parameter application: application
* - parameter error: error
*/
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
AWSPushManager(forKey: ServiceKey).interceptApplication(application, didFailToRegisterForRemoteNotificationsWithError: error)
}
/**
* Handles a received push notification.
* - parameter userInfo: push notification contents
* - parameter completionHandler: Fetches updated content in background. You should call the fetchCompletionHandler as soon as you're finished performing that operation, so the system can accurately estimate its power and data cost.
*/
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
AWSPushManager(forKey: ServiceKey).interceptApplication(application, didReceiveRemoteNotification: userInfo)
}
/**
* Configures all the enabled AWS services from application delegate with options.
*
* - parameter application: instance from application delegate.
* - parameter launchOptions: from application delegate.
*/
func didFinishLaunching(_ application: UIApplication, withOptions launchOptions: [AnyHashable: Any]?) -> Bool {
print("didFinishLaunching:")
var didFinishLaunching: Bool = AWSIdentityManager.default().interceptApplication(application, didFinishLaunchingWithOptions: launchOptions)
didFinishLaunching = didFinishLaunching && AWSPushManager(forKey: ServiceKey).interceptApplication(application, didFinishLaunchingWithOptions: launchOptions)
if (!isInitialized) {
AWSIdentityManager.default().resumeSession(completionHandler: { (result: Any?, error: Error?) in
print("Result: \(result) \n Error:\(error)")
}) // If you get an EXC_BAD_ACCESS here in iOS Simulator, then do Simulator -> "Reset Content and Settings..."
// This will clear bad auth tokens stored by other apps with the same bundle ID.
isInitialized = true
}
return didFinishLaunching
}
}

View File

@@ -0,0 +1,77 @@
//
// AWSAuthorizationManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
extern NSString * _Nonnull const AWSAuthorizationManagerErrorDomain;
typedef NS_ENUM(NSUInteger, AWSAuthorizationManagerError) {
AWSAuthorizationErrorUserCancelledFlow,
AWSAuthorizationErrorConnectionError,
AWSAuthorizationErrorFailedToRetrieveAccessToken,
AWSAuthorizationErrorMissingRequiredParameter,
};
@interface AWSAuthorizationManager : NSObject
/**
* Singleton used to authorize user during OAuth1.0, 2.0, other flows.
* @return the singleton
*/
+ (instancetype _Nonnull)sharedInstance;
/**
* Utility method that constructs form encoded portion of url
* i.e. @{@"grant": @"code", @"client_id": @"abc123"} -> @"grant=code&client_id=abc123&"
*
* @return the string representation of a form
*/
+ (NSString * _Nonnull)constructURIWithParameters:(NSDictionary * _Nonnull)params;
/**
* Utility method that constructs dictionary from simple form encoded url
* i.e. @"grant=code&client_id=abc123" -> @{@"grant": @"code", @"client_id": @"abc123"}
*
* @return the dictionary representation of a url encoded form
*/
+ (NSDictionary * _Nonnull)constructParametersWithURI:(NSString * _Nonnull)formString;
/**
* Starts the authorization flow. Should be called from main thread.
*
* @param authorizeViewController The view controller that user sees right before they should see a login screen.
* @param completionHandler The code that will follow after receiving successful login. Executes BEFORE login screen is dismissed.
*/
- (void)authorizeWithView:(UIViewController * _Nonnull)authorizeViewController completionHandler:(void (^ _Nullable)(id _Nullable result, NSError * _Nullable error)) completionHandler;
/**
* This method should be placed in the AppDelegate to listen for the redirect URI.
*
* - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
*
* @param url The url that the authorization flow gives back.
* @return YES if the url matches an expected response, NO if it is not expected.
*/
- (BOOL)handleURL:(NSURL * _Nullable)url;
/**
* @return the accessToken used for API calls
*/
- (NSString * _Nullable)getAccessToken;
/**
* Starts the logout flow. Should be called from main thread.
*
* @param logoutViewController The view controller that user sees right before they should see a logout indication.
* @param completionHandler The code that will follow after receiving successful login. Executes BEFORE login screen is dismissed.
*/
- (void)logout:(UIViewController * _Nonnull)logoutViewController completionHandler:(void (^ _Nullable)(id _Nullable result, NSError * _Nullable error)) completionHandler;
@end

View File

@@ -0,0 +1,140 @@
//
// AWSCloudLogic.h
//
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <AWSCore/AWSCore.h>
NS_ASSUME_NONNULL_BEGIN
/**
* Cloud logic helper singleton class that provides convenient interface to invoke
* AWS Lambda functions and handle the results asynchronously.
* Requires the AWSLambda framework of AWSiOSSDK.
*/
@interface AWSCloudLogic : NSObject
/**
Returns the default Cloud Logic singleton instance configured using the information provided in `Info.plist` file.
*Swift*
let cloudLogic = AWSCloudLogic.default()
*Objective-C*
AWSCloudLogic *cloudLogic = [AWSCloudLogic defaultCloudLogic];
*/
+ (instancetype)defaultCloudLogic;
/**
Creates a helper client for `AWSCloud` for specified configuration with mentioned key.
Use this method only if you require a helper client with specific configuration.
For example, set the configuration in `- application:didFinishLaunchingWithOptions:`
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSCloudLogic.register(with: configuration, forKey: "USWest2CloudLogic")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
[AWSCloudLogic registerCloudLogicWithConfiguration:configuration
forKey:@"USWest2CloudLogic"];
Then call the following to get the helper client:
*Swift*
let cloudLogic = AWSCloudLogic(forKey: "USWest2CloudLogic")
*Objective-C*
AWSCloudLogic *cloudLogic = [AWSCloudLogic cloudLogicForKey:@"USWest2CloudLogic"];
@warning After calling this method, do not modify the configuration object. It may cause unspecified behaviors.
@param serviceConfiguration AWSServiceConfiguration object for the cloud logic.
@param key A string to identify the helper client.
*/
+ (void)registerCloudLogicWithConfiguration:(AWSServiceConfiguration *)serviceConfiguration
forKey:(NSString *)key;
/**
Retrieves the helper client associated with the key. You need to call `+ registercloudLogicWithConfiguration:` before invoking this method. If `+ registercloudLogicWithConfiguration:` has not been called in advance or the key does not exist, this method returns `nil`.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSCloudLogic.registercloudLogicWithConfiguration(configuration, forKey: "USWest2cloudLogic")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
[AWSCloudLogic registercloudLogicWithConfiguration:configuration
forKey:@"USWest2cloudLogic"];
Then call the following to get the helper client:
*Swift*
let CloudLogic = AWSCloudLogic(forKey: "USWest2cloudLogic")
*Objective-C*
AWSCloudLogic *CloudLogic = [AWSCloudLogic CloudLogicForKey:@"USWest2cloudLogic"];
@param key A string to identify the helper client.
@return An instance of AWSCloudLogic for specified key.
*/
+ (instancetype)CloudLogicForKey:(NSString *)key;
/**
Removes the helper client associated with the key and release it.
*Swift*
AWSCloudLogic.remove(forKey: "USWest2CloudLogic")
*Objective-C*
[AWSCloudLogic removeCloudLogicForKey:@"USWest2CloudLogic"];
@warning Before calling this method, make sure no method is running on this client.
@param key A string to identify the helper client.
*/
+ (void)removeCloudLogicForKey:(NSString *)key;
/**
Invokes the specified AWS Lambda function and passes the results and possible error back to the application asynchronously.
@param name AWS Lambda function name, e.g., hello-world
@param parameters The object from which to generate JSON request data. Can be `nil`.
@param completionBlock handler for results from the function
*/
- (void)invokeFunction:(NSString *)name
withParameters:(nullable id)parameters
completionBlock:(void (^)(id _Nullable result, NSError * _Nullable error))completionBlock;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,86 @@
//
// AWSCognitoUserPoolsSignInProvider.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <Foundation/Foundation.h>
#import "AWSSignInProvider.h"
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString *const AWSCognitoUserPoolsSignInProviderKey;
@protocol AWSCognitoUserPoolsSignInHandler
/**
* This method is called when `loginWithSignInProvider` is called by `AWSIdentityManager`.
* This method should handle the input from the user and set the `taskCompletionSournce` result required by Cognito Idp SDK.
*/
- (void)handleUserPoolSignInFlowStart;
@end
/**
* `AWSCognitoUserPoolsSignInProvider` adopts the `AWSSignInProvider` protocol.
*
* It works with the AWS Cognito User Pools SDK internally.
*/
@interface AWSCognitoUserPoolsSignInProvider : NSObject <AWSSignInProvider>
/**
* Registers the cognito pool with specified configuration. The pool object can be accessed by using the `CognitoIdentityUserPoolForKey:` method using `AWSCognitoUserPoolsSignInProviderKey` as the identifier key.
*
* @param cognitoIdentityUserPoolId The Cognito Identity User Pool Id
* @param cognitoIdentityUserPoolAppClientId The Cognito Identity User Pool Client Id
* @param cognitoIdentityUserPoolAppClientSecret The Cognito Identity User Pool Client Secret
* @param region The Cognito Identity User Pool Service Region
*/
+ (void)setupUserPoolWithId:(NSString *)cognitoIdentityUserPoolId
cognitoIdentityUserPoolAppClientId:(NSString *)cognitoIdentityUserPoolAppClientId
cognitoIdentityUserPoolAppClientSecret:(NSString *)cognitoIdentityUserPoolAppClientSecret
region:(AWSRegionType)region;
/**
Fetches the shared instance for AWSCognitoUserPoolsSignInProvider. The method `setupUserPoolWithId:cognitoIdentityUserPoolAppClientId:cognitoIdentityUserPoolAppClientSecret:region` has to be called once before accessing the shared instance.
@return the single instance of AWSCognitoUserPoolsSignInProvider
*/
+ (instancetype)sharedInstance;
/**
* Set the instance of the class adopting the `AWSCognitoIdentityInteractiveAuthenticationDelegate` protocol of Cognito Idp SDK.
*
* @param interactiveAuthDelegate A class adopting the `AWSCognitoIdentityInteractiveAuthenticationDelegate` protocol
*/
- (void)setInteractiveAuthDelegate:(id)interactiveAuthDelegate;
/**
* Returns the status of the current user pool user.
*
* @return `YES` if the user is signed in.
*/
- (BOOL)isLoggedIn;
/**
* Sets the userName value of the signed-in user into a persistent store.
* Should be called on a successful login to set the user name which is used by `AWSIdentityManager`.
*
* @param userName the user name of the signed-in user
*/
- (void)setUserName:(NSString *)userName;
/**
* Sets the imageURL value of the signed-in user into a persistent store.
* Should be called on a successful login to set the user name which is used by `AWSIdentityManager`.
*
* @param imageURL the image URL for a picture of the signed-in user
*/
- (void)setImageURL:(NSURL *)imageURL;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,601 @@
//
// AWSContentManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <Foundation/Foundation.h>
#import <AWSCore/AWSCore.h>
NS_ASSUME_NONNULL_BEGIN
/**
* The error domain for `AWSContentManager`.
*/
FOUNDATION_EXPORT NSString *const AWSContentManagerErrorDomain;
/**
* The error codes for `AWSContentManager`.
*/
typedef NS_ENUM(NSInteger, AWSContentManagerErrorType){
/**
* Generic error.
*/
AWSContentManagerErrorTypeUnknown,
/**
* Initiated a transfer on a content that is already running.
*/
AWSContentManagerErrorTypeTransferAlreadyInProgress,
/**
* Initiated a transfer on a directory. Directories cannot be downloaded.
*/
AWSContentManagerErrorTypeDirectoryCannotBeDownloaded,
/**
* A server returned a client exception (e.g. HTTP status code 4xx).
*/
AWSContentManagerErrorTypeClientException,
/**
* A server returned a service exception (e.g. HTTP status code 5xx).
*/
AWSContentManagerErrorTypeServiceException,
};
@class AWSContent;
@class AWSContentManagerConfiguration;
/**
* The Content Manager manages caching and transfer of files from Amazon S3 and/or
* Amazon CloudFront. It lists files directly using S3, regardless of whether
* Amazon CloudFront is in use. It maintains a size-limited cache for files stored
* on the local device and provides operations to set the cache size limit and
* clear files from the local cache. It serves as the application's interface into
* the Content Delivery feature. Content Manager instances are also used internally
* for the User Files feature.
* Requires the AWSS3 framework of AWSiOSSDK.
*/
@interface AWSContentManager : NSObject
/**
* Local cache size limit in bytes.
*/
@property (nonatomic, assign) NSUInteger maxCacheSize;
/**
* Local cache bytes used.
*/
@property (nonatomic, readonly) NSUInteger cachedUsedSize;
/**
* Number of bytes pinned in the cache. Pinned items do not count towards the
* cache size limit.
*/
@property (nonatomic, readonly) NSUInteger pinnedSize;
/**
Returns the default Content Manager singleton instance configured using the information provided in `Info.plist` file.
*Swift*
let contentManager = AWSContentManager.default()
*Objective-C*
AWSContentManager *contentManager = [AWSContentManager defaultContentManager];
*/
+ (instancetype)defaultContentManager;
/**
Creates a helper client for AWSContentManager for specified configuration with mentioned key.
Use this method only if you require a helper client with specific configuration.
For example, set the configuration in `- application:didFinishLaunchingWithOptions:`
*Swift*
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let contentManagerConfiguration = AWSContentManagerConfiguration(bucketName: "myBucket")
AWSContentManager.register(with: contentManagerConfiguration, forKey: "defaultManager")
}
*Objective-C*
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSContentManagerConfiguration *contentManagerConfiguration = [[AWSContentManager alloc] initWithBucketName:@"myBucketName"];
[AWSContentManager registerUserFileManagerWithConfiguration:contentManagerConfiguration
forKey:@"defaultManager"];
return YES;
}
Then call the following to get the helper client:
*Swift*
let contentManager = AWSContentManager(forKey: "defaultManager")
*Objective-C*
AWSContentManager *contentManager = [AWSContentManager contentManagerForKey:@"defaultManager"];
@warning After calling this method, do not modify the configuration object. It may cause unspecified behaviors.
@param contentManagerConfiguration AWSContentManagerConfiguration object for the manager.
@param key A string to identify the helper client.
*/
+ (void)registerContentManagerWithConfiguration:(AWSContentManagerConfiguration *)contentManagerConfiguration
forKey:(NSString *)key;
/**
Retrieves the helper client associated with the key. You need to call `+ registerContentManagerWithConfiguration:forKey:` before invoking this method. If `+ registerContentManagerWithConfiguration:forKey:` has not been called in advance or the key does not exist, this method returns `nil`.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let contentManagerConfiguration = AWSContentManagerConfiguration(bucketName: "myBucket")
AWSContentManager.register(with: contentManagerConfiguration, forKey: "defaultManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSContentManagerConfiguration *contentManagerConfiguration = [[AWSContentManager alloc] initWithBucketName:@"myBucketName"];
[AWSContentManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"defaultManager"];
Then call the following to get the helper client:
*Swift*
let ContentManager = AWSContentManager(forKey: "defaultManager")
*Objective-C*
AWSContentManager *ContentManager = [AWSContentManager ContentManagerForKey:@"defaultManager"];
@param key A string to identify the helper client.
@return An instance of AWSUserFileManager for specified key.
*/
+ (instancetype)ContentManagerForKey:(NSString *)key;
/**
Removes the helper client associated with the key and release it.
*Swift*
AWSContentManager.remove(forKey: "defaultManager")
*Objective-C*
[AWSContentManager removeContentManagerForKey:@"defaultManager"];
@warning Before calling this method, make sure no method is running on this client.
@param key A string to identify the helper client.
*/
+ (void)removeContentManagerForKey:(NSString *)key;
/**
Loads the list of available files in the Amazon S3 bucket under the folder specified by the prefix parameter. Results are paged with page size of 100 files. The marker parameter value returned from a call should be passed to a subsequent call, in order to page through the list of files.
*Swift*
let contentManager = AWSContentManager(forKey: "defaultManager")
manager.listAvailableContents(withPrefix: "prefix", marker: marker, completionHandler: {(contents: [AWSContent]?, nextMarker: String?, error: Error?) -> Void in
if let error = error {
print("Failed to load the list of contents. \(error)")
// handle content load failure here
}
if let contents = contents, contents.count > 0 {
// Use marker and contents here
}
// handle successful result here
})
*Objective-C*
AWSContentManager *contentManager = [AWSContentManager contentManagerForKey:@"defaultManager"];
[contentManager
listAvailableContentsWithPrefix:@"prefix"
marker:marker
completionHandler:^(NSArray *contents, NSString *nextMarker, NSError *error) {
if (error) {
NSLog(@"Failed to load the list of contents. %@", error);
// handle content load failure here
}
if (contents.count > 0) {
// Use marker and contents here
}
// handle successful result here
}];
@param prefix Limits the response to keys that begin with the specified prefix.
@param marker The key to start with when listing objects in a bucket. It loads object metadata from the S3 bucket in alphabetical order, starting with the key after the marker in order.
@param completionHandler The completion handler that returns the results and error.
*/
- (void)listAvailableContentsWithPrefix:(nullable NSString *)prefix
marker:(nullable NSString *)marker
completionHandler:(void (^)(NSArray<AWSContent *> * _Nullable contents, NSString * _Nullable marker, NSError * _Nullable error))completionHandler;
/**
Returns a list of contents that fit in the available cache. The list is sorted by last modified date on the S3 bucket, the most recently modified one first.
*Swift*
let contentManager = AWSContentManager(forKey: "defaultManager")
contentManager.listRecentContents(withPrefix: "prefix", completionHandler: {(result: [AWSContent]?, error: Error?) -> Void in
if let error = error {
print("Failed to load the list of recent contents. \(error)")
// Handle error here
}
if let downloadResult: [AWSContent] = result {
// Handle successful result here
for content: AWSContent in downloadResult {
// Handle each of the item in the result
}
}
})
*Objective-C*
AWSContentManager *contentManager = [AWSContentManager contentManagerForKey:@"defaultManager"];
[contentManager listRecentContentsWithPrefix:@"prefix"
completionHandler:^(NSArray<AWSContent *> * result, NSError *error) {
if (error) {
NSLog(@"%@", error.description);
}
for (AWSContent *content in result) {
// Handle each of the item in result
}
}];
@param prefix Limits the response to keys that begin with the specified prefix.
@param completionHandler The completion handler that returns the result and error.
*/
- (void)listRecentContentsWithPrefix:(nullable NSString *)prefix
completionHandler:(void (^)(NSArray<AWSContent *> * _Nullable result, NSError * _Nullable error))completionHandler;
/**
* Removes all cached contents. It does not modify the remote objects.
*/
- (void)clearCache;
/**
Returns an instance of `AWSContent` for a given key. You can use this method to download content without first load its metadata using `- loadContentMetadataWithPrefix:marker:completionHandler:`.
@param key The key of the content.
@return An instance of `AWSContent`.
*/
- (AWSContent *)contentWithKey:(NSString *)key;
@end
/**
* Status of content item download.
*/
typedef NS_ENUM(NSInteger, AWSContentStatusType){
/**
* Unknown status. This should not happen.
*/
AWSContentStatusTypeUnknown,
/**
* Has been created but has not started running yet.
*/
AWSContentStatusTypeNotStarted,
/**
* Is running and transferring data from/to the remote server.
*/
AWSContentStatusTypeRunning,
/**
* Has completed transferring data from/to the remote server.
*/
AWSContentStatusTypeCompleted,
/**
* Has failed to transfer data from/to the remote server.
*/
AWSContentStatusTypeFailed,
};
/**
* Policy to use when downloading a file.
*/
typedef NS_ENUM(NSInteger, AWSContentDownloadType){
/**
* Downalods a file if not cached locally.
*/
AWSContentDownloadTypeIfNotCached,
/**
* Downloads a file if not cached locally or the remote version is newer than the locally cached version.
*/
AWSContentDownloadTypeIfNewerExists,
/**
* Downloads a file and overwrite it if the local cache exists.
*/
AWSContentDownloadTypeAlways,
};
/**
* The content object that holds the cached data and its metadata.
*/
@interface AWSContent : NSObject
/**
* The Amazon S3 key associated with the content.
*/
@property (nonatomic, readonly) NSString *key;
/**
* Shows if the content is a directory.
*/
@property (nonatomic, readonly, getter=isDirectory) BOOL directory;
/**
* The status of the content.
*/
@property (nonatomic, readonly) AWSContentStatusType status;
/**
* The transfer progress.
*/
@property (nonatomic, readonly) NSProgress *progress;
/**
* The last known size reported by the Amazon S3. May be different from the actual size if the file was modified on the server.
*/
@property (nonatomic, readonly) NSUInteger knownRemoteByteCount;
/**
* The last known last modified date reported by the Amazon S3. May be different from the actual last modified date if the file was modified on the server.
*/
@property (nonatomic, readonly) NSDate * _Nullable knownRemoteLastModifiedDate;
/**
* The cached data object.
*/
@property (nonatomic, readonly) NSData *cachedData;
/**
* The cached data size.
*/
@property (nonatomic, readonly) NSUInteger fileSize;
/**
* The date the cached data was downloaded.
*/
@property (nonatomic, readonly) NSDate * _Nullable downloadedDate;
/**
* Wheather the content is locally cached.
*/
@property (nonatomic, readonly, getter=isCached) BOOL cached;
/**
* Weather the content is pinned. Pinned objects are not subject to the content cache limit.
*/
@property (nonatomic, readonly, getter=isPinned) BOOL pinned;
/**
Downloads a file from the remote server.
*Swift*
func downloadContent(content: AWSContent, pinOnCompletion: Bool) {
content.download(with: .ifNewerExists, pinOnCompletion: pinOnCompletion, progressBlock: { (content: AWSContent, content: Progress) in
// Handle progress feedback
}, completionHandler: { (content: AWSContent?, data: Data?, error: Error?) in
if let error = error {
print("Failed to download a content from a server.)")
// Handle error here
return
}
// Handle successful download here
})
}
*Objective-C*
- (void)downloadContent:(AWSContent *)content
pinOnCompletion:(BOOL)pinOnCompletion {
[content downloadWithDownloadType:AWSContentDownloadTypeIfNewerExists
pinOnCompletion:pinOnCompletion
progressBlock:^(AWSContent *content, NSProgress *progress) {
// Handle progress feedback
}
completionHandler:^(AWSContent *content, NSData *data, NSError *error) {
if (error) {
NSLog(@"Failed to download a content from a server. %@", error);
// Handle error here
return;
}
// Handle successful download here
}];
}
@param loadingType Specifies the loading behavior for downloading data.
@param pinOnCompletion When set to `YES`, it pins the content on completion. You can download a content that does not fit in the content cache by setting it to `YES`.
@param progressBlock The progress feedback block.
@param completionHandler The completion handler block.
*/
- (void)downloadWithDownloadType:(AWSContentDownloadType)loadingType
pinOnCompletion:(BOOL)pinOnCompletion
progressBlock:(void(^ _Nullable)(AWSContent *content, NSProgress *progress))progressBlock
completionHandler:(void(^)(AWSContent * _Nullable content, NSData * _Nullable data, NSError * _Nullable error))completionHandler;
/**
Gets Presigned URL or the Cloud Front URL for the file.
*Swift*
func getContentURL(content: AWSContent) {
content.getRemoteFileURLWithCompletionHandler({ (url: URL?, error: Error?) -> Void in
guard let url = url else {
NSLog("Error getting URL for file. \(error)")
return
}
// Handle successfully generated URL here
})
}
*Objective-C*
- (void)getContentURL:(AWSContent *)content {
[content getRemoteFileURLWithCompletionHandler:^(NSURL *url, NSError *error) {
if (error) {
NSLog(@"Failed to get a valid URL from a server. %@", error);
}
// handle successfully generated URL here
}];
}
@param completionHandler The completion handler block.
*/
- (void)getRemoteFileURLWithCompletionHandler:(void(^)(NSURL * _Nullable url, NSError * _Nullable error))completionHandler;
/**
* Pins the locally cached object. Pinned objects are not subject to the content cache limit.
*/
- (void)pin;
/**
* Unpins the pinned object. It may purge the content cache if the content cache does not have enough available space to fit the unpinned data.
*/
- (void)unPin;
/**
* Removes locally cached data regardless of the pinning status.
*/
- (void)removeLocal;
@end
/**
* `AWSContentManagerConfiguration` is the configuration object for `AWSContentManager` class.
*/
@interface AWSContentManagerConfiguration: NSObject
@property (nonatomic, readonly) AWSServiceConfiguration *serviceConfiguration;
@property (nonatomic, readonly) NSString *bucketName;
@property (nonatomic, readonly, nullable) NSString *cloudFrontURL;
/**
Returns an instance of `AWSContentManagerConfiguration` using the default service configuration and specified bucket name. Use this as the configuration object for AWSContentManager.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let contentManagerConfiguration = AWSContentManagerConfiguration(bucketName: "myBucket")
AWSContentManager.register(with: contentManagerConfiguration, forKey: "defaultManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSContentManagerConfiguration *contentManagerConfiguration = [[AWSContentManager alloc] initWithBucketName:@"myBucketName"];
[AWSContentManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"defaultManager"];
@param bucketName Name of the bucket for manager
@return an instance of AWSUserFileManagerConfiguration
*/
- (instancetype)initWithBucketName:(NSString *)bucketName;
/**
Returns an instance of`AWSContentManagerConfiguration` using the specified bucket name, CloudFront URL and the default service configuration. Use this as the configuration object for AWSContentManager.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration;
let contentManagerConfiguration = AWSContentManagerConfiguration(bucketName: "myBucket", cloudFrontURL: "https:/a.b.myurl")
AWSContentManager.register(with: contentManagerConfiguration, forKey: "defaultManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSContentManagerConfiguration *contentManagerConfiguration = [[AWSContentManager alloc] initWithBucketName:@"myBucketName"
cloudFrontURL:@"https:/a.b.myurl"];
[AWSContentManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"defaultManager"];
@param bucketName Name of the bucket for manager
@param cloudFrontURL CloudFront URL for the bucket if enabled; nil otherwise
@return an instance of AWSUserFileManagerConfiguration
*/
- (instancetype)initWithBucketName:(NSString *)bucketName
cloudFrontURL:(nullable NSString *)cloudFrontURL;
/**
Returns an instance of `AWSContentManagerConfiguration` using the specified bucket name, CloudFront URL and service configuration. Use this as the configuration object for AWSContentManager.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
let contentManagerConfiguration = AWSContentManagerConfiguration(bucketName: "myBucket", cloudFrontURL: "https:/a.b.myurl", serviceConfiguration: configuration)
AWSContentManager.register(with: contentManagerConfiguration, forKey: "USWest2BucketContentManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSContentManagerConfiguration *contentManagerConfiguration = [[AWSContentManager alloc] initWithBucketName:@"myBucketName"
cloudFrontURL:@"https:/a.b.myurl"
serviceConfiguration:configuration];
[AWSContentManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"USWest2BucketContentManager"];
@param bucketName Name of the bucket for manager
@param cloudFrontURL CloudFront URL for the bucket if enabled; nil otherwise
@param serviceConfiguration AWSServiceConfiguration for the bucket; nil for default configuration
@return an instance of AWSUserFileManagerConfiguration
*/
- (instancetype)initWithBucketName:(NSString *)bucketName
cloudFrontURL:(nullable NSString *)cloudFrontURL
serviceConfiguration:(nullable AWSServiceConfiguration *)serviceConfiguration;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,55 @@
//
// AWSFacebookSignInProvider.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <Foundation/Foundation.h>
#import "AWSSignInProvider.h"
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString *const AWSFacebookSignInProviderKey;
/**
* `AWSFacebookSignInProvider` adopts the `AWSSignInProvider` protocol.
*
* It works with the FacebookLoginSDK internally and uses the Facebook App ID specified in the info.plist file.
*/
@interface AWSFacebookSignInProvider : NSObject <AWSSignInProvider>
/**
Fetches the singleton instance of AWSFacebookSignInProvider.
@return the singleton instance of AWSFacebookSignInProvider
*/
+ (instancetype)sharedInstance;
/**
Sets the login behavior of the Facebook SignIn SDK.
Choices are listed in enum FBSDKLoginBehavior.
Default behaviors for iOS:
9+ SFSafariViewController used.
8 WebViewController used.
@loginBehavior a FBSDKLoginBehavior enum entry
*/
- (void)setLoginBehavior:(NSUInteger)loginBehavior;
/**
Sets the permissions requested during login.
Default behavior is no permissions are required.
*/
- (void)setPermissions:(NSArray *)permissions;
/**
Sets the ViewController used for Facebook SignIn.
Defaults to nil and handled by Facebook SDK.
*/
- (void)setViewControllerForFacebookSignIn:(UIViewController *)signInViewController;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,44 @@
//
// AWSGoogleSignInProvider.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <Foundation/Foundation.h>
#import "AWSSignInProvider.h"
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString *const AWSGoogleSignInProviderKey;
/**
* `AWSGoogleSignInProvider` adopts the `AWSSignInProvider` protocol.
*
* It works with the Google Sign In SDK internally and requires the Google Client ID provided by Google.
*/
@interface AWSGoogleSignInProvider : NSObject <AWSSignInProvider>
/**
Fetches the shared instance for AWSGoogleSignInProvider.
@return the single instance of AWSGoogleSignInProvider
*/
+ (instancetype)sharedInstance;
/**
Sets the scopes required by the app during login.
Defaults are openid and profile.
*/
- (void)setScopes:(NSArray *)scopes;
/**
Sets the ViewController used for Google SignIn.
Defaults to rootViewController in keyWindow during signin.
*/
- (void)setViewControllerForGoogleSignIn:(UIViewController *)signInViewController;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,57 @@
//
// AWSHubspotAuthorizationManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSAuthorizationManager.h"
@interface AWSHubspotAuthorizationManager : AWSAuthorizationManager
/**
* Singleton used to authorize user during OAuth2.0
* @return the singleton
*/
+ (instancetype _Nonnull)sharedInstance;
/**
* Customize the flow.
*
* @param clientID The client ID provided by Hubspot
* @param portalID The portal ID provided by Hubspot
* @param redirectURI The redirect URI that your app has registered
* i.e. https://mysampleapp.amazonaws.com/hubspot/success
*/
- (void)configureWithClientID:(NSString * _Nonnull)clientID
portalID:(NSString * _Nonnull)portalID
redirectURI:(NSString * _Nonnull)redirectURI;
/**
* Offline Access offline This application can make API requests on behalf of the user when
* the user is offline (not actively using the app). You will receive
* a refresh token when the user authenticates that you can store to
* gain access to a new, valid access token programtically using the
* refresh token method.
* Contacts Read/Write contacts-rw This application reads your contact information, as well as creates
* new contacts, contact lists, and contact properties. It can also
* modify existing contacts, properties, and contact lists.
* Contacts Read-Only contacts-ro This application can read your contact information, as well as
* information about your contact properties and contact lists.
* Blog Read/Write blog-rw This application can read your blog data, including posts and
* comments, as well as create new blog posts and comments.
* Blog Read-Only blog-ro This application can read your blog data, including posts and comments.
* Events Read/Write events-rw This application can read your marketing events, as well as post
* new ones into your HubSpot account.
* Keywords Read/Write keyword-rw This application can read your keyword data, as well as insert new
* ones into your HubSpot account.
*
* @param scope Specify the amount of access the user would like.
* i.e. @"contacts-rw"
* @"contacts-rw+blog-rw"
*/
- (void)setScope:(NSString * _Nonnull)scope;
@end

View File

@@ -0,0 +1,118 @@
//
// AWSIdentityManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <UIKit/UIKit.h>
#import <AWSCore/AWSCore.h>
#import <Foundation/Foundation.h>
#import "AWSSignInProvider.h"
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString *const AWSIdentityManagerDidSignInNotification;
FOUNDATION_EXPORT NSString *const AWSIdentityManagerDidSignOutNotification;
@interface AWSIdentityManager : NSObject<AWSIdentityProviderManager>
/**
* Indicates whether the user is signed-in or not.
* @return true if user is signed-in
*/
@property (nonatomic, readonly, getter=isLoggedIn) BOOL loggedIn;
/**
* URL for the user's image, if user is signed-in with a third party identity provider,
* like Facebook or Google.
* @return url of image file, if user is signed-in
*/
@property (nonatomic, readonly, nullable) NSURL * imageURL;
/**
* User name acquired from third party identity provider, such as Facebook or Google.
* @return user name, if user is signed-in
*/
@property (nonatomic, readonly, nullable) NSString * userName;
/**
* Amazon Cognito User Identity ID. This uniquely identifies the user, regardless of
* whether or not the user is signed-in, if User Sign-in is enabled in the project.
* @return unique user identifier
*/
@property (nonatomic, readonly, nullable) NSString *identityId;
/**
* Amazon Cognito Credentials Provider. This is the credential provider used by the Identity Manager.
*
* @return the cognito credentials provider
*/
@property (nonatomic, readonly, strong) AWSCognitoCredentialsProvider *credentialsProvider;
/**
Returns the Identity Manager singleton instance configured using the information provided in `Info.plist` file.
*Swift*
let identityManager = AWSIdentityManager.default()
*Objective-C*
AWSIdentityManager *identityManager = [AWSIdentityManager defaultIdentityManager];
*/
+ (instancetype)defaultIdentityManager;
/**
* Signs the user out of whatever third party identity provider they used to sign in.
* @param completionHandler used to callback application with async operation results
*/
- (void)logoutWithCompletionHandler:(void (^)(id _Nullable result, NSError * _Nullable error))completionHandler;
/**
* Signs the user in with an identity provider. Note that even if User Sign-in is not
* enabled in the project, the user is still signed-in with the Guest type provider.
* @param signInProviderType provider type
* @param completionHandler used to callback application with async operation results
*/
- (void)loginWithSignInProvider:(id<AWSSignInProvider>)signInProvider
completionHandler:(void (^)(id _Nullable result, NSError * _Nullable error))completionHandler NS_SWIFT_NAME(login(signInProvider:completionHandler:));
/**
* Attempts to resume session with the previous sign-in provider.
* @param completionHandler used to callback application with async operation results
*/
- (void)resumeSessionWithCompletionHandler:(void (^)(id _Nullable result, NSError * _Nullable error))completionHandler;
/**
* Passes parameters used to launch the application to the current identity provider. For some
* third party providers, this completes the User Sign-in call flow, which used a browser to
* get information from the user, directly. The current sign-in provider will be set to nil if
* the sign-in provider is not registered using `registerAWSSignInProvider:forKey` method of
* `AWSSignInProviderFactory` class.
* @param application application
* @param launchOptions options used to launch the application
* @return true if this call handled the operation
*/
- (BOOL)interceptApplication:(UIApplication *)application
didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
/**
* Passes parameters used to launch the application to the current identity provider. For some
* third party providers, this completes the User Sign-in call flow, which used a browser to
* get information from the user, directly.
* @param application application
* @param url url used to open the application
* @param sourceApplication source application
* @param annotation annotation
* @return true if this call handled the operation
*/
- (BOOL)interceptApplication:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(nullable NSString *)sourceApplication
annotation:(id)annotation;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,55 @@
//
// AWSMSDynamicsAuthorizationManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSAuthorizationManager.h"
@interface AWSMSDynamicsAuthorizationManager : AWSAuthorizationManager
/**
* Singleton used to authorize user during OAuth2.0
* @return the singleton
*/
+ (instancetype _Nonnull)sharedInstance;
/**
* Customize the flow.
*
* @param clientID The client ID provided by Microsoft Dynamics
* @param redirectURI The redirect URI you provided Microsoft Dynamics
* i.e. https://mysampleapp.amazonaws.com/msdynamics/success
* @param resource The URL of the resource you will access
*/
- (void)configureWithClientID:(NSString * _Nonnull)clientID
redirectURI:(NSString * _Nonnull)redirectURI
resource:(NSString * _Nonnull)resource;
/**
* @param The version of Microsoft Dynamics API you are using.
* The default value is "v8.0"
*/
- (void)setAPIVersion:(NSString * _Nonnull)apiVersion;
/**
* @return The token type. Available after user authorizes app.
* i.e. Bearer
*/
- (NSString * _Nullable)getTokenType;
/**
* @return The resource you will access in Microsoft Dynamics
* with the API version attached to the end
* i.e. https://emhawsapps.crm.dynamics.com
*/
- (NSString * _Nullable)getResourceURL;
/**
* @return the accessToken used for API calls
*/
- (NSString * _Nullable)getAccessToken;
@end

View File

@@ -0,0 +1,59 @@
//
// AWSMarketoAuthorizationManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSAuthorizationManager.h"
@interface AWSMarketoAuthorizationManager : AWSAuthorizationManager
/**
* Singleton used to authorize user for Marketo
* @return the singleton
*/
+ (instancetype _Nonnull)sharedInstance;
/**
* Customize the flow.
*
* @param clientID Client ID provided by Salesforce.
* @param redirectURI Should be you're bundle ID or universal URL
* i.e. com.amazonaws.mysampleapp://salesforce/success
* https://mysampleapp.amazonaws.com/success
* @return the singleton
*/
- (void)configureWithIdentityURI:(NSString * _Nonnull)identityURI
restApiURI:(NSString * _Nonnull)restApiURI;
/**
* @param clientID Specify the Client ID provided by Marketo.
* i.e. @"abc123...-abc123...-..."
*/
- (void)setClientID:(NSString * _Nonnull)clientID;
/**
* @param clientSecret Specify the Client Secret provided by Marketo.
* i.e. @"aBc123..."
*/
- (void)setClientSecret:(NSString * _Nonnull)clientSecret;
/**
* @return The access token used for API calls
*/
- (NSString * _Nullable)getAccessToken;
/**
* @return The identity URI used during authorization and API calls
*/
- (NSString * _Nullable)getIdentityURI;
/**
* @return The REST API URI used during authorization and API calls
*/
- (NSString * _Nullable)getRestApiURI;
@end

View File

@@ -0,0 +1,26 @@
//
// AWSMobileHubHelper.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSContentManager.h"
#import "AWSCloudLogic.h"
#import "AWSIdentityManager.h"
#import "AWSPushManager.h"
#import "AWSFacebookSignInProvider.h"
#import "AWSGoogleSignInProvider.h"
#import "AWSUserFileManager.h"
#import "AWSSignInProviderFactory.h"
#import "AWSSAMLSignInProvider.h"
#import "AWSCognitoUserPoolsSignInProvider.h"
#import "AWSAuthorizationManager.h"
#import "AWSSalesforceAuthorizationManager.h"
#import "AWSZendeskAuthorizationManager.h"
#import "AWSMSDynamicsAuthorizationManager.h"
#import "AWSQuickbooksAuthorizationManager.h"
#import "AWSHubspotAuthorizationManager.h"
#import "AWSMarketoAuthorizationManager.h"

View File

@@ -0,0 +1,500 @@
//
// AWSPushManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AWSCore/AWSCore.h>
NS_ASSUME_NONNULL_BEGIN
/**
The error domain for `PushManager`.
*/
FOUNDATION_EXPORT NSString *const AWSPushManagerErrorDomain;
/**
The error code for `AWSPushManagerErrorDomain`.
*/
typedef NS_ENUM(NSInteger, AWSPushManagerErrorType){
/**
An unknown error. This should not happen.
*/
AWSPushManagerErrorTypeUnknown,
/**
The device token returned by the OS is invalid and cannot be processed.
*/
AWSPushManagerErrorTypeInvalidDeviceToken,
/**
Unsubscribe requests failed while disabling `PushManager`.
*/
AWSPushManagerErrorTypeUnsubscribeFailed,
};
@class AWSPushManager;
@class AWSPushTopic;
@class AWSPushManagerConfiguration;
@protocol AWSPushManagerDelegate;
@protocol AWSPushTopicDelegate;
/**
The Push Manager registers the app on the device with Apple Push Notification Service (APNS) and registers the resulting device token in Amazon SNS. The result of this registration process is an Amazon SNS Endpoint ARN, which can be used to send push notifications directly to a specific device. The Push Manager also manages Amazon SNS topic subscriptions, allowing the app to subscribe to Amazon SNS topics, which let you target groups of devices with push notifications. Requires the AWSSNS framework of AWSiOSSDK.
*/
@interface AWSPushManager : NSObject
/**
Indicates if `PushManager` is enabled or disabled.
*/
@property (nonatomic, readonly, getter=isEnabled) BOOL enabled;
/**
The device token returned by iOS.
*/
@property (nonatomic, readonly, nullable) NSString *deviceToken;
/**
The application platform endpoint ARN for Amazon SNS.
*/
@property (nonatomic, readonly, nullable) NSString *endpointARN;
/**
The application platform ARN for the app.
*/
@property (nonatomic, readonly, nullable) NSString *platformARN;
/**
A list of topic ARNs selected during project configuraiton on AWS Mobile Hub from the `Info.plist` file.
If a custom helper client is used, it would contain the topic ARNs specified in AWSPushManagerConfiguration object.
*/
@property (nonatomic, readonly, nullable) NSArray<NSString *> * topicARNs;
/**
The list of `PushTopic`.
*/
@property (nonatomic, readonly) NSArray<AWSPushTopic *> *topics;
/**
The delegate for receiving `PushManager` and `PushTopic` events.
*/
@property (nonatomic, weak) id<AWSPushManagerDelegate, AWSPushTopicDelegate> delegate;
/**
Returns the default Push Manager singleton instance configured using the information provided in `Info.plist` file.
*Swift*
let pushManager = AWSPushManager.default()
*Objective-C*
AWSPushManager *pushManager = [AWSPushManager defaultPushManager];
*/
+ (instancetype)defaultPushManager;
/**
Creates a helper client for `AWSPushManager` for specified configuration with mentioned key.
Use this method only if you require a helper client with specific configuration.
For example, set the configuration in `- application:didFinishLaunchingWithOptions:`
*Swift*
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let pushManagerConfiguration = AWSPushManagerConfiguration(snsPlatformARN: "SNS_PLATFORM_ARN")
AWSPushManager.register(with: pushManagerConfiguration, forKey: "defaultPushManager")
return true
}
*Objective-C*
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSPushManagerConfiguration *pushManagerConfiguration = [[AWSPushManager alloc] initWithSNSPlatformARN:@"SNS_PLATFORM_ARN"];
[AWSPushManager registerPushManagerWithConfiguration:pushManagerConfiguration
forKey:@"defaultPushManager"];
return YES;
}
Then call the following to get the helper client:
*Swift*
let pushmanager = AWSPushManager(forKey: "defaultPushManager")
*Objective-C*
AWSPushManager *pushmanager = [AWSPushManager pushManagerForKey:@"defaultPushManager"];
@warning After calling this method, do not modify the configuration object. It may cause unspecified behaviors.
@param pushManagerConfiguration AWSPushManagerConfiguration object for the manager.
@param key A string to identify the helper client.
*/
+ (void)registerPushManagerWithConfiguration:(AWSPushManagerConfiguration *)pushManagerConfiguration
forKey:(NSString *)key;
/**
Retrieves the helper client associated with the key. You need to call `+ registerPushManagerWithConfiguration:forKey:` before invoking this method. If `+ registerPushManagerWithConfiguration:forKey:` has not been called in advance or the key does not exist, this method returns `nil`.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let pushManagerConfiguration = AWSPushManagerConfiguration(snsPlatformARN: "SNS_PLATFORM_ARN")
AWSPushManager.register(with: pushManagerConfiguration, forKey: "defaultPushManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSPushManagerConfiguration *pushManagerConfiguration = [[AWSPushManager alloc] initWithSNSPlatformARN:@"SNS_PLATFORM_ARN"];
[AWSPushManager registerPushManagerWithConfiguration:pushManagerConfiguration
forKey:@"defaultPushManager"];
Then call the following to get the helper client:
*Swift*
let Pushmanager = AWSPushManager(forKey: "defaultPushManager")
*Objective-C*
AWSPushManager *Pushmanager = [AWSPushManager PushManagerForKey:@"defaultPushManager"];
@param key A string to identify the helper client.
@return An instance of AWSPushManager for specified key.
*/
+ (instancetype)PushManagerForKey:(NSString *)key;
/**
Removes the helper client associated with the key and release it.
*Swift*
AWSPushManager.remove(forKey: "USWest2PushManager")
*Objective-C*
[AWSPushManager removePushManagerForKey:@"USWest2PushManager"];
@warning Before calling this method, make sure no method is running on this client.
@param key A string to identify the helper client.
*/
+ (void)removePushManagerForKey:(NSString *)key;
/**
Initializes `PushManager` with the list of topic ARNs.
@param topicARNs A list of topic ARNs from Amazon SNS. It needs to be an `NSArray` containing only `NSString`.
*/
- (void)registerTopicARNs:(NSArray<NSString *> *)topicARNs;
/**
Returns a topic associated with the specified topic ARN.
@param topicARN A topic ARN from Amazon SNS.
@return The topic with the specified topic ARN.
*/
- (AWSPushTopic *)topicForTopicARN:(NSString *)topicARN;
/**
Initiates the process to enable Push Notifications.
When called for the first time, it asks the user for the permission to enable Push Notifications. If the user decline it, it fails to enable Push Notifications.
On success, it calls `- pushManagerDidRegister:` from `AWSPushManagerDelegate`.
On failure, it calls `- pushManager:didFailToRegisterWithError:` from `AWSPushManagerDelegate`.
*/
- (void)registerForPushNotifications;
/**
Unsubscribes from all subscribed topics, then marks `PushManager` as disabled.
On success, it calls `- pushManagerDidDisable:` from `AWSPushManagerDelegate`.
On failure, it calls `- pushManager:didFailToDisableWithError:` from `AWSPushManagerDelegate`.
*/
- (void)disablePushNotifications;
/**
Intercepts the `- application:didFinishLaunchingWithOptions:` application delegate.
@param application Your singleton app object.
@param launchOptions A dictionary indicating the reason the app was launched (if any). The contents of this dictionary may be empty in situations where the user launched the app directly. For information about the possible keys in this dictionary and how to handle them, see Launch Options Keys.
*/
- (BOOL)interceptApplication:(UIApplication *)application
didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
/**
Intercepts the `- application:didRegisterForRemoteNotificationsWithDeviceToken:` application delegate.
@param application The app object that initiated the remote-notification registration process.
@param deviceToken A token that identifies the device to APNs.
*/
- (void)interceptApplication:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
/**
Intercepts the `- application:didFailToRegisterForRemoteNotificationsWithError:` application delegate.
@param application The app object that initiated the remote-notification registration process.
@param error An `NSError` object that encapsulates information why registration did not succeed.
*/
- (void)interceptApplication:(UIApplication *)application
didFailToRegisterForRemoteNotificationsWithError:(nullable NSError *)error;
/**
Intercepts the `- application:didReceiveRemoteNotification:` application delegate.
@param application The app object that received the remote notification.
@param userInfo A dictionary that contains information related to the remote notification, potentially including a badge number for the app icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data. The provider originates it as a JSON-defined dictionary that iOS converts to an `NSDictionary` object; the dictionary may contain only property-list objects plus `NSNull`.
*/
- (void)interceptApplication:(UIApplication *)application
didReceiveRemoteNotification:(nullable NSDictionary *)userInfo;
@end
/**
A topic object.
*/
@interface AWSPushTopic : NSObject
/**
Initializes the topic object with a given topic ARN.
@param topicARN A topic ARN from Amazon SNS.
@return An initialized instance of `PushTopic`.
*/
- (instancetype)initWithTopicARN:(NSString *)topicARN
pushManager:(AWSPushManager *)pushManager;
/**
The topic ARN.
*/
@property (nonatomic, readonly) NSString *topicARN;
/**
The topic name.
*/
@property (nonatomic, readonly) NSString *topicName;
/**
Indicates if the device is registered for the topic.
*/
@property (nonatomic, readonly, getter=isSubscribed) BOOL subscribed;
/**
The subscription ARN from Amazon SNS.
*/
@property (nonatomic, readonly, nullable) NSString *subscriptionARN;
/**
Subscribes the device to the topic.
On success, it calls `- topicDidSubscribe:` from `AWSPushTopicDelegate`.
On failure, it calls `topic:didFailToSubscribeWithError:` from `AWSPushTopicDelegate`.
*/
- (void)subscribe;
/**
Unsubscribes the device from the topic.
On success, it calls `- topicDidUnsubscribe:` from `AWSPushTopicDelegate`.
On failure, it calls `topic:didFailToUnsubscribeWithError:` from `AWSPushTopicDelegate`.
*/
- (void)unsubscribe;
@end
/**
A delegate for receiving `PushManager` events.
*/
@protocol AWSPushManagerDelegate <NSObject>
@required
/**
Indicates the success of the `- registerForPushNotifications` call.
@param pushManager An instance of `PushManager`.
*/
- (void)pushManagerDidRegister:(AWSPushManager *)pushManager;
/**
Indicates the failure of the `- registerForPushNotifications` call.
@param pushManager An instance of `PushManager`.
@param error An `NSError` object that encapsulates information why registration did not succeed.
*/
- (void)pushManager:(AWSPushManager *)pushManager
didFailToRegisterWithError:(NSError *)error;
/**
Indicates the device received a Push Notifiation.
@param userInfo A dictionary that contains information related to the remote notification, potentially including a badge number for the app icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data. The provider originates it as a JSON-defined dictionary that iOS converts to an `NSDictionary` object; the dictionary may contain only property-list objects plus `NSNull`.
*/
- (void)pushManager:(AWSPushManager *)pushManager
didReceivePushNotification:(NSDictionary *)userInfo;
/**
Indicates the success of the `- disablePushNotifications` call.
@param pushManager An instance of `PushManager`.
*/
- (void)pushManagerDidDisable:(AWSPushManager *)pushManager;
/**
Indicates the failure of the `- disablePushNotifications` call.
@param pushManager An instance of `PushManager`.
@param error An `NSError` object that encapsulates information why disable did not succeed.
*/
- (void)pushManager:(AWSPushManager *)pushManager
didFailToDisableWithError:(NSError *)error;
@end
/**
A delegate for receiving `PushTopic` events.
*/
@protocol AWSPushTopicDelegate <NSObject>
@required
/**
Indicates the subscribe succeeded.
@param topic The topic object.
*/
- (void)topicDidSubscribe:(AWSPushTopic *)topic;
/**
Indicates the subscribe failed.
@param topic The topic object.
@param error An `NSError` object that encapsulates information why subscribe did not succeed.
*/
- (void)topic:(AWSPushTopic *)topic
didFailToSubscribeWithError:(NSError *)error;
/**
Indicates the unsubscribe succeeded.
@param topic The topic object.
*/
- (void)topicDidUnsubscribe:(AWSPushTopic *)topic;
/**
Indicates the unsubscribe failed.
@param topic The topic object.
@param error An `NSError` object that encapsulates information why unsubscribe did not succeed.
*/
- (void)topic:(AWSPushTopic *)topic
didFailToUnsubscribeWithError:(NSError *)error;
@end
/**
* `AWSPushManagerConfiguration` is the configuration object for `AWSPushManager` class.
*/
@interface AWSPushManagerConfiguration : NSObject
@property (nonatomic, readonly, nullable) AWSServiceConfiguration *serviceConfiguration;
@property (nonatomic, readonly) NSString *platformARN;
@property (nonatomic, readonly, nullable) NSArray<NSString *> *topicARNs;
/**
Returns an instance of `AWSPushManagerConfiguration`. Use this as the configuration object for AWSPushManager.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let pushManagerConfiguration = AWSPushManagerConfiguration(snsPlatformARN: "SNS_PLATFORM_ARN")
AWSPushManager.register(with: pushManagerConfiguration, forKey: "defaultPushManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSPushManagerConfiguration *pushManagerConfiguration = [[AWSPushManager alloc] initWithSNSPlatformARN:@"SNS_PLATFORM_ARN"];
[AWSPushManager registerPushManagerWithConfiguration:pushManagerConfiguration
forKey:@"defaultPushManager"];
@param snsPlatformARN The SNS Platform ARN
@return an instance of `AWSPushManagerConfiguration`
*/
- (instancetype)initWithPlatformARN:(NSString *)platformARN;
/**
Returns an instance of `AWSPushManagerConfiguration`. Use this as the configuration object for AWSPushManager.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
let pushManagerConfiguration = AWSPushManagerConfiguration(snsPlatformARN: "SNS_PLATFORM_ARN", topicARNs: nil, serviceConfiguration: configuration)
AWSPushManager.register(with: pushManagerConfiguration, forKey: "defaultPushManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1
credentialsProvider:credentialsProvider];
AWSPushManagerConfiguration *pushManagerConfiguration = [[AWSPushManager alloc] initWithSNSPlatformARN:@"SNS_PLATFORM_ARN"
topicARNs:nil
serviceConfiguration:configuration];
[AWSPushManager registerPushManagerWithConfiguration:pushManagerConfiguration
forKey:@"defaultPushManager"];
@param platformARN The SNS Platform ARN
@param topicARN The list of SNS topics that could be registered
@param serviceConfiguration AWSServiceConfiguration object; nil for default configuration
@return an instance of `AWSPushManagerConfiguration`
*/
- (instancetype)initWithPlatformARN:(NSString *)platformARN
topicARNs:(nullable NSArray<NSString *> *)topicARNs
serviceConfiguration:(nullable AWSServiceConfiguration *)serviceConfiguration;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,64 @@
//
// AWSQuickbooksAuthorizationManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSAuthorizationManager.h"
@interface AWSQuickbooksAuthorizationManager : AWSAuthorizationManager
/**
* Singleton used to authorize user during OAuth1.0
* @return the singleton
*/
+ (instancetype _Nonnull)sharedInstance;
/**
* Customize the flow.
*
* @param key The API key provided by Quickbooks
* @param redirectURI The redirect URI you provided Zendesk
* i.e. https://mysampleapp.amazonaws.com/zendesk/success
*/
- (void)configureWithAPIKey:(NSString * _Nonnull)key
redirectURI:(NSString * _Nonnull)redirectURI;
/**
* The secret must be set before attempting to authorize.
* It is recommended that this secret be securely passed to this point.
*
* @param secret The API secret provided by Quickbooks
* i.e. @"abc123"
*/
- (void)setAPISecret:(NSString * _Nonnull)secret;
/**
* @return The API secret used to authorize
*/
- (NSString * _Nullable)getAPIKey;
/**
* @return The API secret used to authorize
*/
- (NSString * _Nullable)getAPISecret;
/**
* @return The access token, available after authorization
*/
- (NSString * _Nullable)getAccessToken;
/**
* @return The token secret, available after authorization
*/
- (NSString * _Nullable)getAccessTokenSecret;
/**
* @return The realm ID, available after authorization
*/
- (NSString * _Nullable)getRealmID;
@end

View File

@@ -0,0 +1,167 @@
//
// AWSSAMLSignInProvider.h
// AWSMobileHubHelper
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSSignInProvider.h"
NS_ASSUME_NONNULL_BEGIN
/**
* Any class over-riding the `AWSSAMLSignInProvider` class for implemeting `SAML` as a sign-in provider,
* should also adopt the `AWSSAMLSignInProviderInstance` protocol.
*/
@protocol AWSSAMLSignInProviderInstance
/**
* The shared instance of the class implementing `SAML` as a sign-in provider.
*
* @return the shared instance of the class implementing `SAML` as a sign-in provider.
*/
+ (id<AWSSignInProvider>)sharedInstance;
@end
@interface AWSSAMLSignInProvider : NSObject <AWSSignInProvider>
#pragma mark - Initializer
/*
The only initializer for AWSSAMLSignInProvider. This initializer has to be used by the class over-riding AWSSAMLSignInProvider.
@param uniqueIdentifier The unique identifier string for the SAML Sign In Provider
@param identityProviderName The identifier provider name for SAML provider (the Identity Provider ARN for SAML)
@return instance of AWSSAMLSignInProvider
*/
- (instancetype)initWithIdentifier:(NSString *)uniqueIdentifier
identityProviderName:(NSString *)identityProviderName;
#pragma mark - Mandatory Override Methods
// The user is expected to over the methods in this pragma mark
/**
* This method will be called when `loginWithSignInProvider` is invoked from `AWSIdentityManager`.
* Developer is expected to call `setResult` on `taskCompletionSource` with the SAML login token on a successful login,
* or `setError` when the login is cancelled or encounters an error.
*
* The token internally is stored in the keychain store, and a flag is set in `NSUserDefaults` indicating the user is logged in using this `SAML` sign-in provider.
*
* ** Objective-C ***
* - (void)handleLoginWithTaskCompletionSource:(AWSTaskCompletionSource<NSString *> *)taskCompletionSource {
* // handle login logic
* if(loginSuccessful) {
* [taskCompletionSource setResult:@"SuccessfullyGeneratedToken"];
* } else {
* [taskCompletionSource setError:error];
* }
* }
*
* ** Swift **
* func handleLogicWithTaskCompletionSource(taskCompletionSource: AWSTaskCompletionSource<String>) {
* if(loginSuccessful) {
* taskCompletionSource.setResult("SuccessfullyGeneratedToken")
* } else {
* taskCompletionSource.setError(error)
* }
* }
*
* @param taskCompletionSource the `AWSTaskCompletionSource` object which is used to call `setResult` or `setError`
*/
- (void)handleLoginWithTaskCompletionSource:(AWSTaskCompletionSource<NSString *> *)taskCompletionSource;
/**
* This method is called whenver the cognito credentials are refreshed or when app is loaded from background state / closed state.
* The previous saved token can be fetched using `fetchStoredToken`, and if it is valid the same can be returned without refreshing.
*
* @return an instance of `AWSTask`. `task.result` should contain the valid token in case of successful token fetch, or `task.error` should be set
*/
- (AWSTask<NSString *>*)fetchLatestToken;
#pragma mark - Optional Override Methods
/**
* Passes parameters used to launch the application to the current identity provider.
* It can be used to complete the user sign-in call flow, which uses a browser to
* get information from the user, directly. The current sign-in provider will be set to nil if
* the sign-in provider is not registered using `registerAWSSignInProvider:forKey` method of
* `AWSSignInProviderFactory` class.
*
* @param application application
* @param launchOptions options used to launch the application
* @return true if this call handled the operation
*/
- (BOOL)interceptApplication:(UIApplication *)application
didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
/**
* Passes parameters used to launch the application to the current identity provider.
* It can be used to complete the user sign-in call flow, which uses a browser to
* get information from the user, directly. The developer should store a reference to
* the `taskCompletionSource` instance provided by the `handleLoginWithTaskCompletionSouce`
* method to set the result with successfully retrieved token.
*
* @param application application
* @param url url used to open the application
* @param sourceApplication source application
* @param annotation annotation
* @return true if this call handled the operation
*/
- (BOOL)interceptApplication:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(nullable NSString *)sourceApplication
annotation:(id)annotation;
#pragma mark - Instance Methods
/**
* Sets the userName value of the signed-in user into a persistent store.
* Should be called on a successful login to set the user name which is used by `AWSIdentityManager`.
*
* @param userName the user name of the signed-in user
*/
- (void)setUserName:(NSString *)userName;
/**
* Sets the imageURL value of the signed-in user into a persistent store.
* Should be called on a successful login to set the user name which is used by `AWSIdentityManager`.
*
* @param imageURL the image URL for a picture of the signed-in user
*/
- (void)setImageURL:(NSURL *)imageURL;
/**
* Can be used to store a reference of teh view controller from which `loginWithSignInProvider` is invoked by `AWSIdentityManager`
*
* @param signInViewController the signInViewController object whose reference needs to be stored
*/
- (void)setViewControllerForSignIn:(UIViewController *)signInViewController;
/**
* This method returns the view controller whose reference was stored using `setViewControllerForSignIn`
*
* @return the stored view controller if set, else `nil`
*/
- (UIViewController *)getViewControllerForSignIn;
/**
* Returns the token stored in keychain as-is (without refreshing)
*
* @return the token if available in keychain, else `nil`
*/
- (NSString *)fetchStoredToken;
/**
* Determines if the user is logged in based on the token available in keychain and if the login flag is set internally.
*
* @return `YES` if the user is logged in using `SAML` sign-in provider instance
*/
- (BOOL)isLoggedIn;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,43 @@
//
// AWSSalesforceAuthorizationManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSAuthorizationManager.h"
@interface AWSSalesforceAuthorizationManager : AWSAuthorizationManager
/**
* Singleton used to authorize user during OAuth2.0
* @return the singleton
*/
+ (instancetype _Nonnull)sharedInstance;
/**
* Customize the flow.
*
* @param clientID Client ID provided by Salesforce.
* @param redirectURI Should be you're bundle ID or universal URL
* i.e. com.amazonaws.mysampleapp://salesforce/success
* https://mysampleapp.amazonaws.com/success
* @return the singleton
*/
- (void)configureWithClientID:(NSString * _Nonnull)clientID redirectURI:(NSString * _Nonnull)redirectURI;
/**
* @return The token type. Available after user authorizes app.
* i.e. Bearer
*/
- (NSString * _Nullable)getTokenType;
/**
* @return The instance Salesforce has assigned you. Available after user authorizes app.
* i.e. https://na15.salesforce.com/
*/
- (NSString * _Nullable)getInstanceURL;
@end

View File

@@ -0,0 +1,84 @@
//
// AWSSignInProvider.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <UIKit/UIKit.h>
#import <AWSCore/AWSCore.h>
NS_ASSUME_NONNULL_BEGIN
@class AWSIdentityManager;
/**
* `AWSSignInProvider` protocol defines a list of methods and properties which a Sign-In Provider should implement.
*
* The AWSSignInProvider is implemented by difference Sign-In Providers like FacbookSignInProvider, GoogleSignInProvider, etc.
*
*/
@protocol AWSSignInProvider <AWSIdentityProvider>
/**
Determines if a user is logged in.
*/
@property (nonatomic, readonly, getter=isLoggedIn) BOOL loggedIn;
/**
The URL for profile image of a user.
*/
@property (nonatomic, readonly, nullable) NSURL *imageURL;
/**
The User Name of a user.
*/
@property (nonatomic, readonly, nullable) NSString *userName;
/**
The login handler method for the Sign-In Provider.
The completionHandler will bubble back errors to the developers.
*/
- (void)login:(void (^)(id _Nullable result, NSError * _Nullable error))completionHandler;
/**
The logout handler method for the Sign-In Provider.
*/
- (void)logout;
/**
* Call this method on a successful login. This method should store a flag in persistent storage which determines if the user has signed-in using this sign-in provider.
* This method is called by AWSIdentityManager on `interceptApplication:didFinishLaunchingWithOptions` method to set the current sign-in provider.
*/
- (void)setCachedLoginFlag;
/**
* Clears the cached login flag. This method should be called during `logout` to clear the stored flag.
*/
- (void)clearCachedLoginFlag;
/**
* Fetches the status of the cached login flag set using `setCachedLoginFlag`.
*
* @return `YES` if the setCachedLoginFlag is set.
*/
- (BOOL)isCachedLoginFlagSet;
/**
The handler method for managing the session reload for the Sign-In Provider.
*/
- (void)reloadSession;
- (BOOL)interceptApplication:(UIApplication *)application
didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
- (BOOL)interceptApplication:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(nullable NSString *)sourceApplication
annotation:(id)annotation;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,44 @@
//
// AWSSignInProviderFactory.h
// AWSMobileHubHelper
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <Foundation/Foundation.h>
#import "AWSSignInProvider.h"
NS_ASSUME_NONNULL_BEGIN
/*
`AWSSignInProviderFactory` stores the instances of the sign in providers implemented using the protocol `AWSSignInProvider`. The instances registered with `AWSSignInProviderFactory` are fetched by `AWSIdentityManager` when `interceptApplication:didFinishLaunchingWithOptions` is called from `AWSMobileClient`.
*/
@interface AWSSignInProviderFactory : NSObject
// Fetches the shared instance of `AWSSignInProviderFactory`.
+(instancetype)sharedInstance;
/**
Registers the shared instance of sign in provider implementing `AWSSignInProvider` with specified key.
@param signInProvider The shared instance of sign in provider implementing `AWSSignInProvider` protocol.
@param key A string to identify the signInProvider.
**/
-(void)registerAWSSignInProvider:(id<AWSSignInProvider>)signInProvider
forKey:(NSString *)key NS_SWIFT_NAME(register(signInProvider:forKey:));
/**
Fetches the shared instance of sign in provider implementing `AWSSignInProvider` with specified key.
@param key A string to identify the signInProvider.
@return The shared instance of sign in provider implementing `AWSSignInProvider` registered with specified key.
**/
-(id<AWSSignInProvider>)signInProviderForKey:(NSString *)key;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,358 @@
//
// AWSUserFileManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import <AWSCore/AWSCore.h>
#import "AWSContentManager.h"
@class AWSLocalContent;
@class AWSUserFileManagerConfiguration;
NS_ASSUME_NONNULL_BEGIN
/**
* `AWSUserFileManager` inherits from `AWSContentManager` and adds the upload capabilities.
*
* The User File Manager uploads and downloads files from Amazon S3. It caches downloaded
* files locally on the device in a size-limited cache. Downloaded files may be pinned
* to the cache, so that they are not automatically removed when the cache size limit
* is exceeded. The User File Manager provides access to two folders in the Amazon S3 bucket,
* one called "public/" for public files, which are accessible to any user of the app,
* and one called "private/" which contains a sub-folder for each Amazon Cognito
* identified user. Files in the user's private folder can only be accessed by that user.
* The User File Manager serves as the application's interface into the file-related
* functionality of the User Data Storage feature.
* Requires the AWSS3 framework of AWSiOSSDK.
*/
@interface AWSUserFileManager : AWSContentManager
/**
* The list of currently uploading contents.
*/
@property (nonatomic, readonly) NSArray<AWSLocalContent *> *uploadingContents;
/**
Returns the default User File Manager singleton instance configured using the information provided in `Info.plist` file.
*Swift*
let userFileManager = AWSUserFileManager.defaultUserFileManager()
*Objective-C*
AWSUserFileManager *userFileManager = [AWSUserFileManager defaultUserFileManager];
*/
+ (instancetype)defaultUserFileManager NS_SWIFT_NAME(defaultUserFileManager());
/**
Creates a helper client for AWSUserFileManager for specified configuration with mentioned key.
Use this method only if you require a helper client with specific configuration.
For example, set the configuration in `- application:didFinishLaunchingWithOptions:`
*Swift*
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
let userFileManagerConfiguration = AWSUserFileManagerConfiguration(bucketName: "myBucket", serviceConfiguration: configuration)
AWSUserFileManager.register(with: userFileManagerConfiguration, forKey: "USWest2BucketManager")
return true
}
*Objective-C*
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSUserFileManagerConfiguration *userFileManagerConfiguration = [[AWSUserFileManager alloc] initWithBucketName:@"myBucketName"
serviceConfiguration:configuration];
[AWSUserFileManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"USWest2BucketManager"];
return YES;
}
Then call the following to get the helper client:
*Swift*
let userFilemanager = AWSUserFileManager(forKey: "USWest2BucketManager")
*Objective-C*
AWSUserFileManager *userFileManager = [AWSUserFileManager userFileManagerForKey:@"USWest2BucketManager"];
@warning After calling this method, do not modify the configuration object. It may cause unspecified behaviors.
@param userFileManagerConfiguration AWSUserFileManagerConfiguration object for the manager.
@param key A string to identify the helper client.
*/
+ (void)registerUserFileManagerWithConfiguration:(AWSUserFileManagerConfiguration *)userFileManagerConfiguration
forKey:(NSString *)key;
/**
Retrieves the helper client associated with the key. You need to call `+ registerUserFileManagerWithConfiguration:forKey:` before invoking this method. If `+ registerUserFileManagerWithConfiguration:forKey:` has not been called in advance or the key does not exist, this method returns `nil`.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
let userFileManagerConfiguration = AWSUserFileManagerConfiguration(bucketName: "myBucket", serviceConfiguration: configuration)
AWSUserFileManager.register(with: userFileManagerConfiguration, forKey: "USWest2BucketManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSUserFileManagerConfiguration *userFileManagerConfiguration = [[AWSUserFileManager alloc] initWithBucketName:@"myBucketName"
serviceConfiguration:configuration];
[AWSUserFileManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"USWest2BucketManager"];
Then call the following to get the helper client:
*Swift*
let UserFilemanager = AWSUserFileManager(forKey: "USWest2BucketManager")
*Objective-C*
AWSUserFileManager *UserFileManager = [AWSUserFileManager UserFileManagerForKey:@"USWest2BucketManager"];
@param key A string to identify the helper client.
@return An instance of AWSUserFileManager for specified key.
*/
+ (instancetype)UserFileManagerForKey:(NSString *)key;
/**
Removes the helper client associated with the key and release it.
*Swift*
AWSUserFileManager.remove(forKey: "USWest2BucketManager")
*Objective-C*
[AWSUserFileManager removeUserFileManagerForKey:@"USWest2BucketManager"];
@warning Before calling this method, make sure no method is running on this client.
@param key A string to identify the helper client.
*/
+ (void)removeUserFileManagerForKey:(NSString *)key;
/**
Returns an instance of `AWSLocalContent`. You use this method to create an instance of `AWSLocalContent` to upload data to an Amazon S3 bucket with the specified key.
*Swift*
func uploadWithData(data: NSData, forKey key: String) {
let userFilemanager = AWSUserFileManager(forKey: "KeyUsedToRegister")
let localContent = userFilemanager.localContent(with: data, key: key)
localContent.uploadWithPinOnCompletion(..., progressBlock: ..., completionHandler: ...)
}
*Objective-C*
- (void)uploadWithData:(NSData *)data forKey:(NSString *)key {
AWSUserFileManager *userFileManager = [AWSUserFileManager userFileManagerForKey:@"KeyUsedToRegister"];
AWSLocalContent *localContent = [self.manager localContentWithData:data
key:key];
[localContent uploadWithPinOnCompletion:...
progressBlock:...
completionHandler:...];
}
@param data The data to be uploaded.
@param key The Amazon S3 key.
@return An instance of `AWSLocalContent` that represents data to be uploaded.
*/
- (AWSLocalContent *)localContentWithData:(nullable NSData *)data
key:(NSString *)key;
@end
/**
* A category to add remote file removal to `AWSContent`.
*/
@interface AWSContent(AWSUserFileManager)
/**
Removes the remote file associated with `AWSContent`.
*Swift*
func removeContent(content: AWSContent) {
content.removeRemoteContent(completionHandler: {(content: AWSContent?, error: NSError?) -> Void in
if let error = error {
print("Failed to delete an object from the remote server. \(error)")
} else {
print("Success")
// Do something further
}
})
}
*Objective-C*
- (void)removeContent:(AWSContent *)content {
[content removeRemoteContentWithCompletionHandler:^(AWSContent *content, NSError *error) {
if (error) {
NSLog(@"Failed to delete an object from the remote server. %@", error);
} else {
NSLog(@"Success");
// Do something further
}
}];
}
@param completionHandler The completion handler block.
*/
- (void)removeRemoteContentWithCompletionHandler:(void(^ _Nullable)(AWSContent * _Nullable content, NSError * _Nullable error))completionHandler;
@end
/**
* A representation of the local content that may not exist in the Amazon S3 bucket yet. When uploading data to an S3 bucket, you first need to create an instance of this class.
*/
@interface AWSLocalContent : AWSContent
/**
Uploads data associated with the local content.
*Swift*
func uploadWithData(data: NSData, forKey key: String) {
let userFilemanager = AWSUserFileManager(forKey: "KeyUsedToRegister")
let localContent = userFilemanager.localContent(with: data, key: key)
localContent.uploadWithPinOnCompletion(false, progressBlock: {(content: AWSLocalContent?, progress: NSProgress?) -> Void in
// handle progress here
}, completionHandler: {(content: AWSContent?, error: Error?) -> Void in
if let error = error {
// handle error here
print("Error occured in uploading: \(error)")
return
}
// handle successful upload here
})
}
*Objective-C*
- (void)uploadWithData:(NSData *)data forKey:(NSString *)key {
AWSUserFileManager *userFileManager = [AWSUserFileManager userFileManagerForKey:@"KeyUsedToRegister"];
AWSLocalContent *localContent = [self.manager localContentWithData:data
key:key];
[localContent uploadWithPinOnCompletion:NO
progressBlock:^(AWSLocalContent *content, NSProgress *progress) {
// handle progress here
}
completionHandler:^(AWSContent *content, NSError *error) {
if (error) {
// handle error here
NSLog(@"Error occured in uploading: %@", error);
return;
}
// perform tasks after successful upload
}];
}
@param pinOnCompletion When set to `YES`, it pins the content after finishing uploading it.
@param progressBlock The upload progress block.
@param completionHandler The completion handler block.
*/
- (void)uploadWithPinOnCompletion:(BOOL)pinOnCompletion
progressBlock:(void(^ _Nullable)(AWSLocalContent *content, NSProgress *progress))progressBlock
completionHandler:(void(^ _Nullable)(AWSLocalContent * _Nullable content, NSError * _Nullable error))completionHandler;
@end
/**
* `AWSUserFileManagerConfiguration` is the configuration object for `AWSUserFileManager` class.
*
*/
@interface AWSUserFileManagerConfiguration: NSObject
@property (nonatomic, assign, readonly) AWSServiceConfiguration *serviceConfiguration;
@property (nonatomic, readonly) NSString *bucketName;
/**
Returns an instance of `AWSUserFileManagerConfiguration`. Use this as the configuration object for AWSUserFileManager.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
let userFileManagerConfiguration = AWSUserFileManagerConfiguration(bucketName: "myBucket", serviceConfiguration: configuration)
AWSUserFileManager.registerUserFileManagerWithConfiguration(userFileManagerConfiguration, forKey: "USWest2BucketManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
AWSUserFileManagerConfiguration *userFileManagerConfiguration = [[AWSUserFileManager alloc] initWithBucketName:@"myBucketName"
serviceConfiguration:configuration];
[AWSUserFileManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"USWest2BucketManager"];
@param bucketName Name of the bucket
@param serviceConfiguration AWSServiceConfiguration object; nil for default configuration
@return an instance of AWSUserFileManagerConfiguration
*/
- (instancetype)initWithBucketName:(NSString *)bucketName
serviceConfiguration:(nullable AWSServiceConfiguration *)serviceConfiguration;
/**
Returns an instance of `AWSUserFileManagerConfiguration` using the default service configuration. Use this as the configuration object for AWSUserFileManager.
*Swift*
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration
let userFileManagerConfiguration = AWSUserFileManagerConfiguration(bucketName: "myBucket")
AWSUserFileManager.registerUserFileManagerWithConfiguration(userFileManagerConfiguration, forKey: "USWest2BucketManager")
*Objective-C*
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
identityPoolId:@"YourIdentityPoolId"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
credentialsProvider:credentialsProvider];
AWSUserFileManagerConfiguration *userFileManagerConfiguration = [[AWSUserFileManager alloc] initWithBucketName:@"myBucketName"];
[AWSUserFileManager registerUserFileManagerWithConfiguration:userFileManagerConfiguration
forKey:@"USWest2BucketManager"];
@param bucketName Name of the bucket
@return an instance of AWSUserFileManagerConfiguration
*/
- (instancetype)initWithBucketName:(NSString *)bucketName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,89 @@
//
// AWSZendeskAuthorizationManager.h
//
// Copyright 2016 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
#import "AWSAuthorizationManager.h"
@interface AWSZendeskAuthorizationManager : AWSAuthorizationManager
/**
* Singleton used to authorize user during OAuth2.0
* @return the singleton
*/
+ (instancetype _Nonnull)sharedInstance;
/**
* Customize the flow. This relies on the redirectURI being an Universal link.
*
* @param clientID The client ID that you signed up for in Zendesk
* @param redirectURI The redirect URI you provided Zendesk
* i.e. https://mysampleapp.amazonaws.com/zendesk/success
* @param subdomain The subdomain that you signed up for in Zendesk
*/
- (void)configureWithClientID:(NSString * _Nonnull)clientID
redirectURI:(NSString * _Nonnull)redirectURI
subdomain:(NSString * _Nonnull)subdomain;
/**
* If you are unable to setup Universal links at this moment, then for development purposes
* you may consider use a HTTPS endpoint that you control to redirect to a custom app scheme url.
*
* Example:
* Endpoint HTML content at https://awsmobilehub.s3-us-west-2.amazonaws.com/zendesk
* <html>
* <script>window.location.href = "com.amazon.mysampleapp://zendesk/oauth2" + window.location.href;</script>
* </html>
*
* customSchemeRedirectURI = @"com.amazon.mysampleapp://zendesk/oauth2";
* httpsEndpoint = @"https://awsmobilehub.s3-us-west-2.amazonaws.com/zendesk";
*
* @param clientID The client ID that you signed up for in Zendesk
* @param customSchemeRedirectURI The redirectURI that has the custom app scheme
* @param httpsEndpoint The HTTPS endpoint that needs to be registered with Zendesk.
* This endpoint must redirect the page to the customSchemeRedirectURI
* provided here.
* @param subdomain The subdomain that you signed up for in Zendesk
*/
- (void)configureWithClientID:(NSString * _Nonnull)clientID
setCustomSchemeRedirectURI:(NSString * _Nonnull)customSchemeRedirectURI
httpsEndpoint:(NSString * _Nonnull)httpsEndpoint
subdomain:(NSString * _Nonnull)subdomain;
/**
*
* Available scopes:
* tickets
* users
* auditlogs (read only)
* organizations
* hc
* apps
* triggers
* automations
* targets
*
* @param scope Specify the amount of access the user would like.
* i.e. @"read"
* @"read tickets:write"
* @"tickets:read tickets:write"
*/
- (void)setScope:(NSString * _Nonnull)scope;
/**
* @return The token type. Available after user authorizes app.
* i.e. Bearer
*/
- (NSString * _Nullable)getTokenType;
/**
* @return The subdomain that you signed up for in Zendesk.
* i.e. aws
*/
- (NSString * _Nullable)getSubdomain;
@end

View File

@@ -0,0 +1,6 @@
framework module AWSMobileHubHelper {
umbrella header "AWSMobileHubHelper.h"
export *
module * { export * }
}

View File

@@ -0,0 +1,82 @@
//
// OnboardingPager.swift
// BCU Mind
//
// Created by Alexander Davis on 24/03/2017.
// Copyright © 2017 Alexander Davis. All rights reserved.
//
import UIKit
class OnboardingPager : UIPageViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override func viewDidLoad() {
// Set the dataSource and delegate in code.
// I can't figure out how to do this in the Storyboard!
dataSource = self
delegate = self
// This is the starting point. Start with step zero.
setViewControllers([getStepZero()], direction: .forward, animated: false, completion: nil)
}
func getStepZero() -> StepZero {
return storyboard!.instantiateViewController(withIdentifier: "WelcomeScreenOne") as! StepZero
}
func getStepOne() -> StepOne {
return storyboard!.instantiateViewController(withIdentifier: "WelcomeScreenTwo") as! StepOne
}
func getStepTwo() -> StepTwo {
return storyboard!.instantiateViewController(withIdentifier: "WelcomeScreenThree") as! StepTwo
}
}
// MARK: - UIPageViewControllerDataSource methods
extension OnboardingPager : UIPageViewControllerDataSource {
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
if viewController.isKind(of: StepTwo.self) {
// 2 -> 1
return getStepOne()
} else if viewController.isKind(of: StepOne.self) {
// 1 -> 0
return getStepZero()
} else {
// 0 -> end of the road
return nil
}
}
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
if viewController.isKind(of: StepZero.self) {
// 0 -> 1
return getStepOne()
} else if viewController.isKind(of: StepOne.self) {
// 1 -> 2
return getStepTwo()
} else {
// 2 -> end of the road
return nil
}
}
// This only gets called once, when setViewControllers is called
func presentationIndex(for pageViewController: UIPageViewController) -> Int {
return 0
}
}
// MARK: - UIPageViewControllerDelegate methods
extension OnboardingPager : UIPageViewControllerDelegate {
}

View File

@@ -0,0 +1,47 @@
//
// AppDelegate.swift
// BCU Mind
//
// Created by Alexander Davis on 17/11/2016.
// Copyright © 2016 Alexander Davis Computing and Media. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
return AWSMobileClient.sharedInstance.didFinishLaunching(application, withOptions: launchOptions)
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return AWSMobileClient.sharedInstance.withApplication(application, withURL: url, withSourceApplication: sourceApplication, withAnnotation: annotation)
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
AWSMobileClient.sharedInstance.applicationDidBecomeActive(application)
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

View File

@@ -0,0 +1,152 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon-App-57x57@1x.png",
"scale" : "1x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon-App-57x57@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "50x50",
"idiom" : "ipad",
"filename" : "Icon-Small-50x50@1x.png",
"scale" : "1x"
},
{
"size" : "50x50",
"idiom" : "ipad",
"filename" : "Icon-Small-50x50@2x.png",
"scale" : "2x"
},
{
"size" : "72x72",
"idiom" : "ipad",
"filename" : "Icon-App-72x72@1x.png",
"scale" : "1x"
},
{
"size" : "72x72",
"idiom" : "ipad",
"filename" : "Icon-App-72x72@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Birmingham_City_University_logo_with_white_tiger.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "first.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "second.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>

View File

@@ -0,0 +1,492 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="4MW-gF-WXR">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Refferals-->
<scene sceneID="hNz-n2-bh7">
<objects>
<viewController id="9pv-A4-QxB" userLabel="Refferals" customClass="FirstViewController" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ia1-K6-d13"/>
<viewControllerLayoutGuide type="bottom" id="4ug-Mw-9AY"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="tsR-hK-woN">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" fixedFrame="YES" text="Referrals" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="KQZ-1w-vlD">
<rect key="frame" x="109" y="28" width="157.5" height="42"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<tabBarItem key="tabBarItem" title="Refferals" image="Referrals" id="acW-dT-cKf"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="753" y="717"/>
</scene>
<!--View Controller-->
<scene sceneID="6Zn-Kj-GxT">
<objects>
<viewController id="pYa-pS-21V" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Man-VV-XDt"/>
<viewControllerLayoutGuide type="bottom" id="EdF-bj-Tz9"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="gYH-jJ-PuR">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ud3-ld-hhy" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1630" y="716"/>
</scene>
<!--View Controller-->
<scene sceneID="wLW-mO-7PS">
<objects>
<viewController id="jL9-1Z-AfK" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="dgS-Wp-MqR"/>
<viewControllerLayoutGuide type="bottom" id="Xon-zz-BKH"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="GLl-mz-fyU">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vrM-R5-s2O" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2532" y="716"/>
</scene>
<!--View Controller-->
<scene sceneID="gNk-K6-eBF">
<objects>
<viewController id="GBb-LO-xuP" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="hnE-WA-IwG"/>
<viewControllerLayoutGuide type="bottom" id="KoC-PT-tv4"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="g48-wv-rZ4">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ol3-vL-Vjj" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2532" y="1400"/>
</scene>
<!--View Controller-->
<scene sceneID="l3Z-kS-Aeb">
<objects>
<viewController id="fkI-sX-xbn" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gQL-fe-XSq"/>
<viewControllerLayoutGuide type="bottom" id="1WN-SF-i4r"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Y3O-Hr-gen">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jLI-oM-01h" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2532" y="2079"/>
</scene>
<!--Appointments-->
<scene sceneID="wg7-f3-ORb">
<objects>
<viewController id="8rJ-Kc-sve" userLabel="Appointments" customClass="SecondViewController" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="L7p-HK-0SC"/>
<viewControllerLayoutGuide type="bottom" id="Djb-ko-YwX"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="QS5-Rx-YEW">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="BhP-FJ-kZf">
<rect key="frame" x="0.0" y="64" width="375" height="546"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="sectionIndexColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="sectionIndexBackgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</tableView>
<navigationBar contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="S0j-wk-VZN">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<items>
<navigationItem title="My Appointments" id="78b-zR-L5C">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="KZ8-JJ-nhx">
<connections>
<segue destination="9rE-Ev-0UQ" kind="show" id="3vO-CZ-y11"/>
</connections>
</barButtonItem>
</navigationItem>
</items>
</navigationBar>
</subviews>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<tabBarItem key="tabBarItem" title="Appointments" image="Appointments" selectedImage="Appointments" id="cPa-gy-q4n"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4Nw-L8-lE0" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1247" y="1400"/>
</scene>
<!--Forum-->
<scene sceneID="zmS-Mh-CAl">
<objects>
<viewController id="b7Q-H0-SWR" customClass="ForumViewController" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gbe-ax-vjG"/>
<viewControllerLayoutGuide type="bottom" id="9YQ-Ge-TWk"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="fv7-zL-NSF">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5pQ-0s-4MO">
<rect key="frame" x="0.0" y="28" width="375" height="546"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</webView>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Att-Y8-g3m">
<rect key="frame" x="0.0" y="574" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Dcx-fi-fIz"/>
<barButtonItem systemItem="stop" id="Snr-HU-rL2">
<connections>
<action selector="stopLoading" destination="5pQ-0s-4MO" id="eFZ-BS-EA6"/>
</connections>
</barButtonItem>
<barButtonItem systemItem="refresh" id="tbz-UC-ZzT">
<connections>
<action selector="reload" destination="5pQ-0s-4MO" id="RJP-5J-cEt"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="s48-ZA-n3z"/>
</items>
</toolbar>
</subviews>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<tabBarItem key="tabBarItem" title="Forum" image="Forum" id="c4f-Um-cPb"/>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
<connections>
<outlet property="webView" destination="5pQ-0s-4MO" id="dnl-I8-glV"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Yl4-5H-Wl1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="753" y="2080"/>
</scene>
<!--View Controller-->
<scene sceneID="glz-9f-ztX">
<objects>
<viewController id="9rE-Ev-0UQ" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="kkc-pe-uaE"/>
<viewControllerLayoutGuide type="bottom" id="wGW-nk-War"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="lWx-2M-bFP">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="wod-b6-rMg" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1822" y="2080"/>
</scene>
<!--Login-->
<scene sceneID="Lcr-ZV-idN">
<objects>
<viewController storyboardIdentifier="Login" title="Login" id="A1e-ja-5EP" customClass="Login" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="hNJ-OM-ZaD"/>
<viewControllerLayoutGuide type="bottom" id="6KL-7E-MWi"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="99J-aN-HKQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Username" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="9GS-gW-dbY" userLabel="Usernametbx">
<rect key="frame" x="109" y="93" width="250" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" clearsOnBeginEditing="YES" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="2bs-Gk-4mu" userLabel="Passwordtbx">
<rect key="frame" x="109" y="131" width="250" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iHF-33-slM" userLabel="Usernamelbl">
<rect key="frame" x="16" y="96" width="85" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Password" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XYH-rP-aSL" userLabel="Passwordlbl">
<rect key="frame" x="16" y="137" width="85" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dHT-jT-gCz" userLabel="Loginbtn">
<rect key="frame" x="313" y="169" width="46" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Login"/>
<connections>
<segue destination="49e-Tb-3d3" kind="show" id="xDc-ft-hPj"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="BCU Mind Login" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="web-Kj-pIo" userLabel="BCU Mind Loginlbl">
<rect key="frame" x="16" y="29" width="343" height="59"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="43"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tGA-BG-gPu" userLabel="SignUpbtn">
<rect key="frame" x="63" y="207" width="248" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Don't Have An Account? Sign Up"/>
<connections>
<segue destination="6at-zd-T3n" kind="show" id="OBS-ep-1yb"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
<connections>
<outlet property="loginbtn" destination="dHT-jT-gCz" id="a3K-OU-Ymd"/>
<outlet property="logintbx" destination="9GS-gW-dbY" id="hXc-k3-Z0V"/>
<outlet property="passwordtbx" destination="2bs-Gk-4mu" id="NjD-GC-wA9"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="E6m-GA-zqU" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-799" y="1064"/>
</scene>
<!--Sign Up-->
<scene sceneID="SbK-8G-4Zr">
<objects>
<viewController title="Sign Up" id="6at-zd-T3n" customClass="SignUp" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="hpx-rs-tOU"/>
<viewControllerLayoutGuide type="bottom" id="Em0-Og-Jrx"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="nDF-nh-gLs">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XeE-jo-SSI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-799" y="1738"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="yl2-sM-qoP">
<objects>
<tabBarController id="49e-Tb-3d3" sceneMemberID="viewController">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
<nil key="simulatedBottomBarMetrics"/>
<tabBar key="tabBar" contentMode="scaleToFill" id="W28-zg-YXA">
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</tabBar>
<connections>
<segue destination="9pv-A4-QxB" kind="relationship" relationship="viewControllers" id="u7Y-xg-7CH"/>
<segue destination="8rJ-Kc-sve" kind="relationship" relationship="viewControllers" id="lzU-1b-eKA"/>
<segue destination="b7Q-H0-SWR" kind="relationship" relationship="viewControllers" id="aYW-e1-OYQ"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HuB-VB-40B" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-33" y="1401"/>
</scene>
<!--Onboarding Pager-->
<scene sceneID="mH6-1A-SWu">
<objects>
<pageViewController autoresizesArchivedViewToFullSize="NO" transitionStyle="scroll" navigationOrientation="horizontal" spineLocation="none" id="4MW-gF-WXR" customClass="OnboardingPager" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
</pageViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cI6-8S-mCU" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2426" y="1255"/>
</scene>
<!--WelcomeScreenOne-->
<scene sceneID="Fd4-Vz-nqu">
<objects>
<viewController storyboardIdentifier="WelcomeScreenOne" id="KXk-Vh-SFk" userLabel="WelcomeScreenOne" customClass="StepZero" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="QOE-Bd-Kim"/>
<viewControllerLayoutGuide type="bottom" id="Yah-08-Rno"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Xgb-Ex-9XU">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="myl-rZ-OdO">
<rect key="frame" x="0.0" y="623" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items>
<barButtonItem style="plain" systemItem="flexibleSpace" id="N8Y-Jf-H8D"/>
<barButtonItem title="Login" id="sCb-JY-bUc">
<connections>
<segue destination="A1e-ja-5EP" kind="show" id="jxA-0w-ASw"/>
</connections>
</barButtonItem>
<barButtonItem title="Sign Up" id="EmJ-xZ-Phm">
<connections>
<segue destination="6at-zd-T3n" kind="show" id="MvK-2L-SLk"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="GeG-eD-zm0"/>
</items>
</toolbar>
<label opaque="NO" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Welcome to BCU Mind" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ecx-Ca-yuh">
<rect key="frame" x="16" y="224" width="343" height="165"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="48"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<pageControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="3" translatesAutoresizingMaskIntoConstraints="NO" id="Gbh-Hw-PfH">
<rect key="frame" x="168" y="586" width="39" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</pageControl>
</subviews>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="98a-UN-17l" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1740" y="608"/>
</scene>
<!--WelcomeScreenTwo-->
<scene sceneID="2Ui-9Z-CBe">
<objects>
<viewController storyboardIdentifier="WelcomeScreenTwo" id="ag8-bK-dP7" userLabel="WelcomeScreenTwo" customClass="StepOne" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="V5g-WX-6Pd"/>
<viewControllerLayoutGuide type="bottom" id="N77-EB-Ch7"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="odj-3e-onR">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HOV-Z9-lLx">
<rect key="frame" x="0.0" y="623" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items>
<barButtonItem style="plain" systemItem="flexibleSpace" id="R3M-rO-NLu"/>
<barButtonItem title="Login" id="fme-F5-aZ5">
<connections>
<segue destination="A1e-ja-5EP" kind="show" id="JOA-Z1-4e9"/>
</connections>
</barButtonItem>
<barButtonItem title="Sign Up" id="E5g-cx-vZU">
<connections>
<segue destination="6at-zd-T3n" kind="show" id="8XV-xi-aN6"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="m1E-3k-za8"/>
</items>
</toolbar>
<pageControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="3" currentPage="1" translatesAutoresizingMaskIntoConstraints="NO" id="P0X-8K-bDP">
<rect key="frame" x="168" y="586" width="39" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</pageControl>
</subviews>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="f2p-Wa-fTZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1740" y="1255"/>
</scene>
<!--WelcomeScreenThree-->
<scene sceneID="izU-pe-JMu">
<objects>
<viewController storyboardIdentifier="WelcomeScreenThree" id="DKX-wZ-hfp" userLabel="WelcomeScreenThree" customClass="StepTwo" customModule="BCU_Mind" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="SZ2-wG-4Qe"/>
<viewControllerLayoutGuide type="bottom" id="x9X-Q0-Z9C"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="XQ8-Ig-16Y">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="edX-rm-8Jc">
<rect key="frame" x="0.0" y="623" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Qpb-66-08a"/>
<barButtonItem title="Login" id="Lri-nw-5rs">
<connections>
<segue destination="A1e-ja-5EP" kind="show" id="DPh-rx-maQ"/>
</connections>
</barButtonItem>
<barButtonItem title="Sign Up" id="cuE-em-FcZ">
<connections>
<segue destination="6at-zd-T3n" kind="show" id="ZRi-my-ZRe"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="dsM-cL-sGF"/>
</items>
</toolbar>
<pageControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="3" currentPage="2" translatesAutoresizingMaskIntoConstraints="NO" id="mgg-hA-Ouv">
<rect key="frame" x="168" y="586" width="39" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</pageControl>
</subviews>
<color key="backgroundColor" red="0.0039215686274509803" green="0.047058823529411764" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5Ki-xS-AeR" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1740" y="1906"/>
</scene>
</scenes>
<resources>
<image name="Appointments" width="30" height="30"/>
<image name="Forum" width="30" height="30"/>
<image name="Referrals" width="30" height="30"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="DPh-rx-maQ"/>
<segue reference="OBS-ep-1yb"/>
</inferredMetricsTieBreakers>
</document>

View File

@@ -0,0 +1,29 @@
//
// FirstViewController.swift
// BCU Mind
//
// Created by Alexander Davis on 17/11/2016.
// Copyright © 2016 Alexander Davis Computing and Media. All rights reserved.
//
import UIKit
class FirstViewController: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

View File

@@ -0,0 +1,33 @@
//
// ForumViewController.swift
// BCU Mind
//
// Created by Alexander Davis on 24/03/2017.
// Copyright © 2017 Alexander Davis. All rights reserved.
//
import UIKit
class ForumViewController: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
@IBOutlet var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let url = NSURL (string: "https://www.bcumind.com");
let requestObj = NSURLRequest(url: url! as URL);
webView.loadRequest(requestObj as URLRequest);
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

View File

@@ -0,0 +1,23 @@
//
// HelperLibrary.swift
// BCU Mind
//
// Created by Alexander Davis on 24/03/2017.
// Copyright © 2017 Alexander Davis. All rights reserved.
//
import Foundation
class HelperLibrary {
// helper function to delay whatever's in the callback
class func delay(_ seconds: Double, completion:@escaping ()->()) {
let popTime = DispatchTime.now() + Double(Int64( Double(NSEC_PER_SEC) * seconds )) / Double(NSEC_PER_SEC)
DispatchQueue.main.asyncAfter(deadline: popTime) {
completion()
}
}
}

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>Launch</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>AWS</key>
<dict>
<key>IdentityManager</key>
<dict>
<key>Default</key>
<dict/>
</dict>
<key>CredentialsProvider</key>
<dict>
<key>CognitoIdentity</key>
<dict>
<key>Default</key>
<dict>
<key>PoolId</key>
<string>eu-west-1:05d2d0bb-768f-4033-91b6-fa916ccf7ae9</string>
<key>Region</key>
<string>eu-west-1</string>
</dict>
</dict>
</dict>
<key>MobileHub</key>
<dict>
<key>ProjectClientId</key>
<string>MobileHub 23deaf7b-4cc6-4f40-b149-569d683afb38 aws-my-sample-app-ios-swift-v0.12</string>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,17 @@
//
// Login.swift
// BCU Mind
//
// Created by Alexander Davis on 24/03/2017.
// Copyright © 2017 Alexander Davis. All rights reserved.
//
import UIKit
class Login : UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,43 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2017 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// NSError category extension providing methods to get data out of Realm's
/// "client reset" error.
@interface NSError (RLMSync)
/**
Given a Realm Object Server client reset error, return the block that can
be called to manually initiate the client reset process, or nil if the
error isn't a client reset error.
*/
- (nullable void(^)(void))rlmSync_clientResetBlock NS_REFINED_FOR_SWIFT;
/**
Given a Realm Object Server client reset error, return the path where the
backup copy of the Realm will be placed once the client reset process is
complete.
*/
- (nullable NSString *)rlmSync_clientResetBackedUpRealmPath NS_SWIFT_UNAVAILABLE("");
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,380 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Realm/RLMCollection.h>
NS_ASSUME_NONNULL_BEGIN
@class RLMObject, RLMRealm, RLMResults<RLMObjectType: RLMObject *>, RLMNotificationToken;
/**
`RLMArray` is the container type in Realm used to define to-many relationships.
Unlike an `NSArray`, `RLMArray`s hold a single type, specified by the `objectClassName` property.
This is referred to in these docs as the “type” of the array.
When declaring an `RLMArray` property, the type must be marked as conforming to a
protocol by the same name as the objects it should contain (see the
`RLM_ARRAY_TYPE` macro). In addition, the property can be declared using Objective-C
generics for better compile-time type safety.
RLM_ARRAY_TYPE(ObjectType)
...
@property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;
`RLMArray`s can be queried with the same predicates as `RLMObject` and `RLMResult`s.
`RLMArray`s cannot be created directly. `RLMArray` properties on `RLMObject`s are
lazily created when accessed, or can be obtained by querying a Realm.
### Key-Value Observing
`RLMArray` supports array key-value observing on `RLMArray` properties on `RLMObject`
subclasses, and the `invalidated` property on `RLMArray` instances themselves is
key-value observing compliant when the `RLMArray` is attached to a managed
`RLMObject` (`RLMArray`s on unmanaged `RLMObject`s will never become invalidated).
Because `RLMArray`s are attached to the object which they are a property of, they
do not require using the mutable collection proxy objects from
`-mutableArrayValueForKey:` or KVC-compatible mutation methods on the containing
object. Instead, you can call the mutation methods on the `RLMArray` directly.
*/
@interface RLMArray<RLMObjectType: RLMObject *> : NSObject<RLMCollection, NSFastEnumeration>
#pragma mark - Properties
/**
The number of objects in the array.
*/
@property (nonatomic, readonly, assign) NSUInteger count;
/**
The class name (i.e. type) of the `RLMObject`s contained in the array.
*/
@property (nonatomic, readonly, copy) NSString *objectClassName;
/**
The Realm which manages the array. Returns `nil` for unmanaged arrays.
*/
@property (nonatomic, readonly, nullable) RLMRealm *realm;
/**
Indicates if the array can no longer be accessed.
*/
@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;
#pragma mark - Accessing Objects from an Array
/**
Returns the object at the index specified.
@param index The index to look up.
@return An `RLMObject` of the type contained in the array.
*/
- (RLMObjectType)objectAtIndex:(NSUInteger)index;
/**
Returns the first object in the array.
Returns `nil` if called on an empty array.
@return An `RLMObject` of the type contained in the array.
*/
- (nullable RLMObjectType)firstObject;
/**
Returns the last object in the array.
Returns `nil` if called on an empty array.
@return An `RLMObject` of the type contained in the array.
*/
- (nullable RLMObjectType)lastObject;
#pragma mark - Adding, Removing, and Replacing Objects in an Array
/**
Adds an object to the end of the array.
@warning This method may only be called during a write transaction.
@param object An `RLMObject` of the type contained in the array.
*/
- (void)addObject:(RLMObjectType)object;
/**
Adds an array of objects to the end of the array.
@warning This method may only be called during a write transaction.
@param objects An enumerable object such as `NSArray` or `RLMResults` which contains objects of the
same class as the array.
*/
- (void)addObjects:(id<NSFastEnumeration>)objects;
/**
Inserts an object at the given index.
Throws an exception if the index exceeds the bounds of the array.
@warning This method may only be called during a write transaction.
@param anObject An `RLMObject` of the type contained in the array.
@param index The index at which to insert the object.
*/
- (void)insertObject:(RLMObjectType)anObject atIndex:(NSUInteger)index;
/**
Removes an object at the given index.
Throws an exception if the index exceeds the bounds of the array.
@warning This method may only be called during a write transaction.
@param index The array index identifying the object to be removed.
*/
- (void)removeObjectAtIndex:(NSUInteger)index;
/**
Removes the last object in the array.
@warning This method may only be called during a write transaction.
*/
- (void)removeLastObject;
/**
Removes all objects from the array.
@warning This method may only be called during a write transaction.
*/
- (void)removeAllObjects;
/**
Replaces an object at the given index with a new object.
Throws an exception if the index exceeds the bounds of the array.
@warning This method may only be called during a write transaction.
@param index The index of the object to be replaced.
@param anObject An object (of the same type as returned from the `objectClassName` selector).
*/
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(RLMObjectType)anObject;
/**
Moves the object at the given source index to the given destination index.
Throws an exception if the index exceeds the bounds of the array.
@warning This method may only be called during a write transaction.
@param sourceIndex The index of the object to be moved.
@param destinationIndex The index to which the object at `sourceIndex` should be moved.
*/
- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex;
/**
Exchanges the objects in the array at given indices.
Throws an exception if either index exceeds the bounds of the array.
@warning This method may only be called during a write transaction.
@param index1 The index of the object which should replace the object at index `index2`.
@param index2 The index of the object which should replace the object at index `index1`.
*/
- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2;
#pragma mark - Querying an Array
/**
Returns the index of an object in the array.
Returns `NSNotFound` if the object is not found in the array.
@param object An object (of the same type as returned from the `objectClassName` selector).
*/
- (NSUInteger)indexOfObject:(RLMObjectType)object;
/**
Returns the index of the first object in the array matching the predicate.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return The index of the object, or `NSNotFound` if the object is not found in the array.
*/
- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;
/// :nodoc:
- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;
/**
Returns the index of the first object in the array matching the predicate.
@param predicate The predicate with which to filter the objects.
@return The index of the object, or `NSNotFound` if the object is not found in the array.
*/
- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;
/**
Returns all the objects matching the given predicate in the array.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return An `RLMResults` of objects that match the given predicate.
*/
- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat, ...;
/// :nodoc:
- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
/**
Returns all the objects matching the given predicate in the array.
@param predicate The predicate with which to filter the objects.
@return An `RLMResults` of objects that match the given predicate
*/
- (RLMResults<RLMObjectType> *)objectsWithPredicate:(NSPredicate *)predicate;
/**
Returns a sorted `RLMResults` from the array.
@param keyPath The key path to sort by.
@param ascending The direction to sort in.
@return An `RLMResults` sorted by the specified key path.
*/
- (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
/**
Returns a sorted `RLMResults` from the array.
@param property The property name to sort by.
@param ascending The direction to sort in.
@return An `RLMResults` sorted by the specified property.
*/
- (RLMResults<RLMObjectType> *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending
__deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`");
/**
Returns a sorted `RLMResults` from the array.
@param properties An array of `RLMSortDescriptor`s to sort by.
@return An `RLMResults` sorted by the specified properties.
*/
- (RLMResults<RLMObjectType> *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;
/// :nodoc:
- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index;
/// :nodoc:
- (void)setObject:(RLMObjectType)newValue atIndexedSubscript:(NSUInteger)index;
#pragma mark - Notifications
/**
Registers a block to be called each time the array changes.
The block will be asynchronously called with the initial array, and then
called again after each write transaction which changes any of the objects in
the array, which objects are in the results, or the order of the objects in the
array.
The `changes` parameter will be `nil` the first time the block is called.
For each call after that, it will contain information about
which rows in the array were added, removed or modified. If a write transaction
did not modify any objects in the array, the block is not called at all.
See the `RLMCollectionChange` documentation for information on how the changes
are reported and an example of updating a `UITableView`.
If an error occurs the block will be called with `nil` for the results
parameter and a non-`nil` error. Currently the only errors that can occur are
when opening the Realm on the background worker thread.
Notifications are delivered via the standard run loop, and so can't be
delivered while the run loop is blocked by other activity. When
notifications can't be delivered instantly, multiple notifications may be
coalesced into a single notification. This can include the notification
with the initial results. For example, the following code performs a write
transaction immediately after adding the notification block, so there is no
opportunity for the initial notification to be delivered first. As a
result, the initial notification will reflect the state of the Realm after
the write transaction.
Person *person = [[Person allObjectsInRealm:realm] firstObject];
NSLog(@"person.dogs.count: %zu", person.dogs.count); // => 0
self.token = [person.dogs addNotificationBlock(RLMArray<Dog *> *dogs,
RLMCollectionChange *changes,
NSError *error) {
// Only fired once for the example
NSLog(@"dogs.count: %zu", dogs.count) // => 1
}];
[realm transactionWithBlock:^{
Dog *dog = [[Dog alloc] init];
dog.name = @"Rex";
[person.dogs addObject:dog];
}];
// end of run loop execution context
You must retain the returned token for as long as you want updates to continue
to be sent to the block. To stop receiving updates, call `-stop` on the token.
@warning This method cannot be called during a write transaction, or when the
containing Realm is read-only.
@warning This method may only be called on a managed array.
@param block The block to be called each time the array changes.
@return A token which must be held for as long as you want updates to be delivered.
*/
- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray<RLMObjectType> *__nullable array,
RLMCollectionChange *__nullable changes,
NSError *__nullable error))block __attribute__((warn_unused_result));
#pragma mark - Unavailable Methods
/**
`-[RLMArray init]` is not available because `RLMArray`s cannot be created directly.
`RLMArray` properties on `RLMObject`s are lazily created when accessed, or can be obtained by querying a Realm.
*/
- (instancetype)init __attribute__((unavailable("RLMArrays cannot be created directly")));
/**
`+[RLMArray new]` is not available because `RLMArray`s cannot be created directly.
`RLMArray` properties on `RLMObject`s are lazily created when accessed, or can be obtained by querying a Realm.
*/
+ (instancetype)new __attribute__((unavailable("RLMArrays cannot be created directly")));
@end
/// :nodoc:
@interface RLMArray (Swift)
// for use only in Swift class definitions
- (instancetype)initWithObjectClassName:(NSString *)objectClassName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,351 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "RLMThreadSafeReference.h"
NS_ASSUME_NONNULL_BEGIN
@class RLMRealm, RLMResults, RLMObject, RLMSortDescriptor, RLMNotificationToken, RLMCollectionChange;
/**
A homogenous collection of `RLMObject` instances. Examples of conforming types include `RLMArray`,
`RLMResults`, and `RLMLinkingObjects`.
*/
@protocol RLMCollection <NSFastEnumeration, RLMThreadConfined>
@required
#pragma mark - Properties
/**
The number of objects in the collection.
*/
@property (nonatomic, readonly, assign) NSUInteger count;
/**
The class name (i.e. type) of the `RLMObject`s contained in the collection.
*/
@property (nonatomic, readonly, copy) NSString *objectClassName;
/**
The Realm which manages the collection, or `nil` for unmanaged collections.
*/
@property (nonatomic, readonly) RLMRealm *realm;
#pragma mark - Accessing Objects from a Collection
/**
Returns the object at the index specified.
@param index The index to look up.
@return An `RLMObject` of the type contained in the collection.
*/
- (id)objectAtIndex:(NSUInteger)index;
/**
Returns the first object in the collection.
Returns `nil` if called on an empty collection.
@return An `RLMObject` of the type contained in the collection.
*/
- (nullable id)firstObject;
/**
Returns the last object in the collection.
Returns `nil` if called on an empty collection.
@return An `RLMObject` of the type contained in the collection.
*/
- (nullable id)lastObject;
#pragma mark - Querying a Collection
/**
Returns the index of an object in the collection.
Returns `NSNotFound` if the object is not found in the collection.
@param object An object (of the same type as returned from the `objectClassName` selector).
*/
- (NSUInteger)indexOfObject:(RLMObject *)object;
/**
Returns the index of the first object in the collection matching the predicate.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return The index of the object, or `NSNotFound` if the object is not found in the collection.
*/
- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;
/// :nodoc:
- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;
/**
Returns the index of the first object in the collection matching the predicate.
@param predicate The predicate with which to filter the objects.
@return The index of the object, or `NSNotFound` if the object is not found in the collection.
*/
- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;
/**
Returns all objects matching the given predicate in the collection.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return An `RLMResults` containing objects that match the given predicate.
*/
- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...;
/// :nodoc:
- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
/**
Returns all objects matching the given predicate in the collection.
@param predicate The predicate with which to filter the objects.
@return An `RLMResults` containing objects that match the given predicate.
*/
- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate;
/**
Returns a sorted `RLMResults` from the collection.
@param keyPath The keyPath to sort by.
@param ascending The direction to sort in.
@return An `RLMResults` sorted by the specified key path.
*/
- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
/**
Returns a sorted `RLMResults` from the collection.
@param property The property name to sort by.
@param ascending The direction to sort in.
@return An `RLMResults` sorted by the specified property.
*/
- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending
__deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`");
/**
Returns a sorted `RLMResults` from the collection.
@param properties An array of `RLMSortDescriptor`s to sort by.
@return An `RLMResults` sorted by the specified properties.
*/
- (RLMResults *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;
/// :nodoc:
- (id)objectAtIndexedSubscript:(NSUInteger)index;
/**
Returns an `NSArray` containing the results of invoking `valueForKey:` using `key` on each of the collection's objects.
@param key The name of the property.
@return An `NSArray` containing results.
*/
- (nullable id)valueForKey:(NSString *)key;
/**
Invokes `setValue:forKey:` on each of the collection's objects using the specified `value` and `key`.
@warning This method may only be called during a write transaction.
@param value The object value.
@param key The name of the property.
*/
- (void)setValue:(nullable id)value forKey:(NSString *)key;
#pragma mark - Notifications
/**
Registers a block to be called each time the collection changes.
The block will be asynchronously called with the initial collection, and then
called again after each write transaction which changes either any of the
objects in the collection, or which objects are in the collection.
The `change` parameter will be `nil` the first time the block is called.
For each call after that, it will contain information about
which rows in the collection were added, removed or modified. If a write transaction
did not modify any objects in this collection, the block is not called at all.
See the `RLMCollectionChange` documentation for information on how the changes
are reported and an example of updating a `UITableView`.
If an error occurs the block will be called with `nil` for the collection
parameter and a non-`nil` error. Currently the only errors that can occur are
when opening the Realm on the background worker thread.
At the time when the block is called, the collection object will be fully
evaluated and up-to-date, and as long as you do not perform a write transaction
on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will
never perform blocking work.
Notifications are delivered via the standard run loop, and so can't be
delivered while the run loop is blocked by other activity. When
notifications can't be delivered instantly, multiple notifications may be
coalesced into a single notification. This can include the notification
with the initial collection. For example, the following code performs a write
transaction immediately after adding the notification block, so there is no
opportunity for the initial notification to be delivered first. As a
result, the initial notification will reflect the state of the Realm after
the write transaction.
id<RLMCollection> collection = [Dog allObjects];
NSLog(@"dogs.count: %zu", dogs.count); // => 0
self.token = [collection addNotificationBlock:^(id<RLMCollection> dogs,
RLMCollectionChange *changes,
NSError *error) {
// Only fired once for the example
NSLog(@"dogs.count: %zu", dogs.count); // => 1
}];
[realm transactionWithBlock:^{
Dog *dog = [[Dog alloc] init];
dog.name = @"Rex";
[realm addObject:dog];
}];
// end of run loop execution context
You must retain the returned token for as long as you want updates to continue
to be sent to the block. To stop receiving updates, call `-stop` on the token.
@warning This method cannot be called during a write transaction, or when the
containing Realm is read-only.
@param block The block to be called each time the collection changes.
@return A token which must be held for as long as you want collection notifications to be delivered.
*/
- (RLMNotificationToken *)addNotificationBlock:(void (^)(id<RLMCollection> __nullable collection,
RLMCollectionChange *__nullable change,
NSError *__nullable error))block __attribute__((warn_unused_result));
@end
/**
An `RLMSortDescriptor` stores a property name and a sort order for use with
`sortedResultsUsingDescriptors:`. It is similar to `NSSortDescriptor`, but supports
only the subset of functionality which can be efficiently run by Realm's query
engine.
`RLMSortDescriptor` instances are immutable.
*/
@interface RLMSortDescriptor : NSObject
#pragma mark - Properties
/**
The key path which the sort descriptor orders results by.
*/
@property (nonatomic, readonly) NSString *keyPath;
/**
Whether the descriptor sorts in ascending or descending order.
*/
@property (nonatomic, readonly) BOOL ascending;
#pragma mark - Methods
/**
Returns a new sort descriptor for the given key path and sort direction.
*/
+ (instancetype)sortDescriptorWithKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
/**
Returns a copy of the receiver with the sort direction reversed.
*/
- (instancetype)reversedSortDescriptor;
#pragma mark - Deprecated
/**
The name of the property which the sort descriptor orders results by.
*/
@property (nonatomic, readonly) NSString *property __deprecated_msg("Use `-keyPath`");
/**
Returns a new sort descriptor for the given property name and sort direction.
*/
+ (instancetype)sortDescriptorWithProperty:(NSString *)propertyName ascending:(BOOL)ascending
__deprecated_msg("Use `+sortDescriptorWithKeyPath:ascending:`");
@end
/**
A `RLMCollectionChange` object encapsulates information about changes to collections
that are reported by Realm notifications.
`RLMCollectionChange` is passed to the notification blocks registered with
`-addNotificationBlock` on `RLMArray` and `RLMResults`, and reports what rows in the
collection changed since the last time the notification block was called.
The change information is available in two formats: a simple array of row
indices in the collection for each type of change, and an array of index paths
in a requested section suitable for passing directly to `UITableView`'s batch
update methods. A complete example of updating a `UITableView` named `tv`:
[tv beginUpdates];
[tv deleteRowsAtIndexPaths:[changes deletionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
[tv insertRowsAtIndexPaths:[changes insertionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
[tv reloadRowsAtIndexPaths:[changes modificationsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
[tv endUpdates];
All of the arrays in an `RLMCollectionChange` are always sorted in ascending order.
*/
@interface RLMCollectionChange : NSObject
/// The indices of objects in the previous version of the collection which have
/// been removed from this one.
@property (nonatomic, readonly) NSArray<NSNumber *> *deletions;
/// The indices in the new version of the collection which were newly inserted.
@property (nonatomic, readonly) NSArray<NSNumber *> *insertions;
/**
The indices in the new version of the collection which were modified.
For `RLMResults`, this means that one or more of the properties of the object at
that index were modified (or an object linked to by that object was
modified).
For `RLMArray`, the array itself being modified to contain a
different object at that index will also be reported as a modification.
*/
@property (nonatomic, readonly) NSArray<NSNumber *> *modifications;
/// Returns the index paths of the deletion indices in the given section.
- (NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section;
/// Returns the index paths of the insertion indices in the given section.
- (NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section;
/// Returns the index paths of the modification indices in the given section.
- (NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,204 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// For compatibility with Xcode 7, before extensible string enums were introduced,
#ifdef NS_EXTENSIBLE_STRING_ENUM
#define RLM_EXTENSIBLE_STRING_ENUM NS_EXTENSIBLE_STRING_ENUM
#define RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(_, extensible_string_enum) NS_SWIFT_NAME(extensible_string_enum)
#else
#define RLM_EXTENSIBLE_STRING_ENUM
#define RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(fully_qualified, _) NS_SWIFT_NAME(fully_qualified)
#endif
#if __has_attribute(ns_error_domain) && (!defined(__cplusplus) || !__cplusplus || __cplusplus >= 201103L)
#define RLM_ERROR_ENUM(type, name, domain) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wignored-attributes\"") \
NS_ENUM(type, __attribute__((ns_error_domain(domain))) name) \
_Pragma("clang diagnostic pop")
#else
#define RLM_ERROR_ENUM(type, name, domain) NS_ENUM(type, name)
#endif
#pragma mark - Enums
/**
`RLMPropertyType` is an enumeration describing all property types supported in Realm models.
For more information, see [Realm Models](https://realm.io/docs/objc/latest/#models).
*/
// Make sure numbers match those in <realm/data_type.hpp>
typedef NS_ENUM(int32_t, RLMPropertyType) {
#pragma mark - Primitive types
/** Integers: `NSInteger`, `int`, `long`, `Int` (Swift) */
RLMPropertyTypeInt = 0,
/** Booleans: `BOOL`, `bool`, `Bool` (Swift) */
RLMPropertyTypeBool = 1,
/** Floating-point numbers: `float`, `Float` (Swift) */
RLMPropertyTypeFloat = 9,
/** Double-precision floating-point numbers: `double`, `Double` (Swift) */
RLMPropertyTypeDouble = 10,
#pragma mark - Object types
/** Strings: `NSString`, `String` (Swift) */
RLMPropertyTypeString = 2,
/** Binary data: `NSData` */
RLMPropertyTypeData = 4,
/**
Any object: `id`.
This property type is no longer supported for new models. However, old models with any-typed properties are still
supported for migration purposes.
*/
RLMPropertyTypeAny = 6,
/** Dates: `NSDate` */
RLMPropertyTypeDate = 8,
#pragma mark - Array/Linked object types
/** Realm model objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
RLMPropertyTypeObject = 12,
/** Realm arrays. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
RLMPropertyTypeArray = 13,
/** Realm linking objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
RLMPropertyTypeLinkingObjects = 14,
};
/** An error domain identifying Realm-specific errors. */
extern NSString * const RLMErrorDomain;
/** An error domain identifying non-specific system errors. */
extern NSString * const RLMUnknownSystemErrorDomain;
/**
`RLMError` is an enumeration representing all recoverable errors. It is associated with the
Realm error domain specified in `RLMErrorDomain`.
*/
typedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) {
/** Denotes a general error that occurred when trying to open a Realm. */
RLMErrorFail = 1,
/** Denotes a file I/O error that occurred when trying to open a Realm. */
RLMErrorFileAccess = 2,
/**
Denotes a file permission error that ocurred when trying to open a Realm.
This error can occur if the user does not have permission to open or create
the specified file in the specified access mode when opening a Realm.
*/
RLMErrorFilePermissionDenied = 3,
/** Denotes an error where a file was to be written to disk, but another file with the same name already exists. */
RLMErrorFileExists = 4,
/**
Denotes an error that occurs if a file could not be found.
This error may occur if a Realm file could not be found on disk when trying to open a
Realm as read-only, or if the directory part of the specified path was not found when
trying to write a copy.
*/
RLMErrorFileNotFound = 5,
/**
Denotes an error that occurs if a file format upgrade is required to open the file,
but upgrades were explicitly disabled.
*/
RLMErrorFileFormatUpgradeRequired = 6,
/**
Denotes an error that occurs if the database file is currently open in another
process which cannot share with the current process due to an
architecture mismatch.
This error may occur if trying to share a Realm file between an i386 (32-bit) iOS
Simulator and the Realm Browser application. In this case, please use the 64-bit
version of the iOS Simulator.
*/
RLMErrorIncompatibleLockFile = 8,
/** Denotes an error that occurs when there is insufficient available address space. */
RLMErrorAddressSpaceExhausted = 9,
/** Denotes an error that occurs if there is a schema version mismatch, so that a migration is required. */
RLMErrorSchemaMismatch = 10,
};
#pragma mark - Constants
#pragma mark - Notification Constants
/**
A notification indicating that changes were made to a Realm.
*/
typedef NSString * RLMNotification RLM_EXTENSIBLE_STRING_ENUM;
/**
This notification is posted by a Realm when the data in that Realm has changed.
More specifically, this notification is posted after a Realm has been refreshed to
reflect a write transaction. This can happen when an autorefresh occurs, when
`-[RLMRealm refresh]` is called, after an implicit refresh from `-[RLMRealm beginWriteTransaction]`,
or after a local write transaction is completed.
*/
extern RLMNotification const RLMRealmRefreshRequiredNotification
RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmRefreshRequiredNotification, RefreshRequired);
/**
This notification is posted by a Realm when a write transaction has been
committed to a Realm on a different thread for the same file.
It is not posted if `-[RLMRealm autorefresh]` is enabled, or if the Realm is
refreshed before the notification has a chance to run.
Realms with autorefresh disabled should normally install a handler for this
notification which calls `-[RLMRealm refresh]` after doing some work. Refreshing
the Realm is optional, but not refreshing the Realm may lead to large Realm
files. This is because Realm must keep an extra copy of the data for the stale
Realm.
*/
extern RLMNotification const RLMRealmDidChangeNotification
RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmDidChangeNotification, DidChange);
#pragma mark - Other Constants
/** The schema version used for uninitialized Realms */
extern const uint64_t RLMNotVersioned;
/** The corresponding value is the name of an exception thrown by Realm. */
extern NSString * const RLMExceptionName;
/** The corresponding value is a Realm file version. */
extern NSString * const RLMRealmVersionKey;
/** The corresponding key is the version of the underlying database engine. */
extern NSString * const RLMRealmCoreVersionKey;
/** The corresponding key is the Realm invalidated property name. */
extern NSString * const RLMInvalidatedKey;
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,127 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class RLMSchema;
@class RLMArray;
@class RLMObject;
/**
A block type which provides both the old and new versions of an object in the Realm. Object
properties can only be accessed using keyed subscripting.
@see `-[RLMMigration enumerateObjects:block:]`
@param oldObject The object from the original Realm (read-only).
@param newObject The object from the migrated Realm (read-write).
*/
typedef void (^RLMObjectMigrationBlock)(RLMObject * __nullable oldObject, RLMObject * __nullable newObject);
/**
`RLMMigration` instances encapsulate information intended to facilitate a schema migration.
A `RLMMigration` instance is passed into a user-defined `RLMMigrationBlock` block when updating
the version of a Realm. This instance provides access to the old and new database schemas, the
objects in the Realm, and provides functionality for modifying the Realm during the migration.
*/
@interface RLMMigration : NSObject
#pragma mark - Properties
/**
Returns the old `RLMSchema`. This is the schema which describes the Realm before the
migration is applied.
*/
@property (nonatomic, readonly) RLMSchema *oldSchema;
/**
Returns the new `RLMSchema`. This is the schema which describes the Realm after the
migration is applied.
*/
@property (nonatomic, readonly) RLMSchema *newSchema;
#pragma mark - Altering Objects during a Migration
/**
Enumerates all the objects of a given type in the Realm, providing both the old and new versions
of each object. Within the block, object properties can only be accessed using keyed subscripting.
@param className The name of the `RLMObject` class to enumerate.
@warning All objects returned are of a type specific to the current migration and should not be cast
to `className`. Instead, treat them as `RLMObject`s and use keyed subscripting to access
properties.
*/
- (void)enumerateObjects:(NSString *)className block:(__attribute__((noescape)) RLMObjectMigrationBlock)block;
/**
Creates and returns an `RLMObject` instance of type `className` in the Realm being migrated.
The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or
dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed
property. An exception will be thrown if any required properties are not present and those properties were not defined
with default values.
When passing in an `NSArray` as the `value` argument, all properties must be present, valid and in the same order as
the properties defined in the model.
@param className The name of the `RLMObject` class to create.
@param value The value used to populate the object.
*/
- (RLMObject *)createObject:(NSString *)className withValue:(id)value;
/**
Deletes an object from a Realm during a migration.
It is permitted to call this method from within the block passed to `-[enumerateObjects:block:]`.
@param object Object to be deleted from the Realm being migrated.
*/
- (void)deleteObject:(RLMObject *)object;
/**
Deletes the data for the class with the given name.
All objects of the given class will be deleted. If the `RLMObject` subclass no longer exists in your program,
any remaining metadata for the class will be removed from the Realm file.
@param name The name of the `RLMObject` class to delete.
@return A Boolean value indicating whether there was any data to delete.
*/
- (BOOL)deleteDataForClassName:(NSString *)name;
/**
Renames a property of the given class from `oldName` to `newName`.
@param className The name of the class whose property should be renamed. This class must be present
in both the old and new Realm schemas.
@param oldName The old name for the property to be renamed. There must not be a property with this name in the
class as defined by the new Realm schema.
@param newName The new name for the property to be renamed. There must not be a property with this name in the
class as defined by the old Realm schema.
*/
- (void)renamePropertyForClass:(NSString *)className oldName:(NSString *)oldName newName:(NSString *)newName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,535 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Realm/RLMObjectBase.h>
#import <Realm/RLMThreadSafeReference.h>
NS_ASSUME_NONNULL_BEGIN
@class RLMNotificationToken;
@class RLMObjectSchema;
@class RLMPropertyChange;
@class RLMPropertyDescriptor;
@class RLMRealm;
@class RLMResults;
/**
`RLMObject` is a base class for model objects representing data stored in Realms.
Define your model classes by subclassing `RLMObject` and adding properties to be managed.
Then instantiate and use your custom subclasses instead of using the `RLMObject` class directly.
// Dog.h
@interface Dog : RLMObject
@property NSString *name;
@property BOOL adopted;
@end
// Dog.m
@implementation Dog
@end //none needed
### Supported property types
- `NSString`
- `NSInteger`, `int`, `long`, `float`, and `double`
- `BOOL` or `bool`
- `NSDate`
- `NSData`
- `NSNumber<X>`, where `X` is one of `RLMInt`, `RLMFloat`, `RLMDouble` or `RLMBool`, for optional number properties
- `RLMObject` subclasses, to model many-to-one relationships.
- `RLMArray<X>`, where `X` is an `RLMObject` subclass, to model many-to-many relationships.
### Querying
You can initiate queries directly via the class methods: `allObjects`, `objectsWhere:`, and `objectsWithPredicate:`.
These methods allow you to easily query a custom subclass for instances of that class in the default Realm.
To search in a Realm other than the default Realm, use the `allObjectsInRealm:`, `objectsInRealm:where:`,
and `objectsInRealm:withPredicate:` class methods.
@see `RLMRealm`
### Relationships
See our [Cocoa guide](https://realm.io/docs/objc/latest#relationships) for more details.
### Key-Value Observing
All `RLMObject` properties (including properties you create in subclasses) are
[Key-Value Observing compliant](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html),
except for `realm` and `objectSchema`.
Keep the following tips in mind when observing Realm objects:
1. Unlike `NSMutableArray` properties, `RLMArray` properties do not require
using the proxy object returned from `-mutableArrayValueForKey:`, or defining
KVC mutation methods on the containing class. You can simply call methods on
the `RLMArray` directly; any changes will be automatically observed by the containing
object.
2. Unmanaged `RLMObject` instances cannot be added to a Realm while they have any
observed properties.
3. Modifying managed `RLMObject`s within `-observeValueForKeyPath:ofObject:change:context:`
is not recommended. Properties may change even when the Realm is not in a write
transaction (for example, when `-[RLMRealm refresh]` is called after changes
are made on a different thread), and notifications sent prior to the change
being applied (when `NSKeyValueObservingOptionPrior` is used) may be sent at
times when you *cannot* begin a write transaction.
*/
@interface RLMObject : RLMObjectBase <RLMThreadConfined>
#pragma mark - Creating & Initializing Objects
/**
Creates an unmanaged instance of a Realm object.
Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm.
@see `[RLMRealm addObject:]`
*/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
/**
Creates an unmanaged instance of a Realm object.
Pass in an `NSArray` or `NSDictionary` instance to set the values of the object's properties.
Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm.
@see `[RLMRealm addObject:]`
*/
- (instancetype)initWithValue:(id)value NS_DESIGNATED_INITIALIZER;
/**
Returns the class name for a Realm object subclass.
@warning Do not override. Realm relies on this method returning the exact class
name.
@return The class name for the model class.
*/
+ (NSString *)className;
/**
Creates an instance of a Realm object with a given value, and adds it to the default Realm.
If nested objects are included in the argument, `createInDefaultRealmWithValue:` will be recursively called
on them.
The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
`NSJSONSerialization`, or an array containing one element for each managed property. An exception will be thrown if
any required properties are not present and those properties were not defined with default values.
When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
properties defined in the model.
@param value The value used to populate the object.
@see `defaultPropertyValues`
*/
+ (instancetype)createInDefaultRealmWithValue:(id)value;
/**
Creates an instance of a Realm object with a given value, and adds it to the specified Realm.
If nested objects are included in the argument, `createInRealm:withValue:` will be recursively called
on them.
The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
`NSJSONSerialization`, or an array containing one element for each managed property. An exception will be thrown if any
required properties are not present and those properties were not defined with default values.
When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
properties defined in the model.
@param realm The Realm which should manage the newly-created object.
@param value The value used to populate the object.
@see `defaultPropertyValues`
*/
+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value;
/**
Creates or updates a Realm object within the default Realm.
This method may only be called on Realm object types with a primary key defined. If there is already
an object with the same primary key value in the default Realm, its values are updated and the object
is returned. Otherwise, this method creates and populates a new instance of the object in the default Realm.
If nested objects are included in the argument, `createOrUpdateInDefaultRealmWithValue:` will be
recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not.
If the argument is a Realm object already managed by the default Realm, the argument's type is the same
as the receiver, and the objects have identical values for their managed properties, this method does nothing.
The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or
dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed
property. An exception will be thrown if any required properties are not present and those properties were not defined
with default values.
When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
properties defined in the model.
@param value The value used to populate the object.
@see `defaultPropertyValues`, `primaryKey`
*/
+ (instancetype)createOrUpdateInDefaultRealmWithValue:(id)value;
/**
Creates or updates an Realm object within a specified Realm.
This method may only be called on Realm object types with a primary key defined. If there is already
an object with the same primary key value in the given Realm, its values are updated and the object
is returned. Otherwise this method creates and populates a new instance of this object in the given Realm.
If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be
recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not.
If the argument is a Realm object already managed by the given Realm, the argument's type is the same
as the receiver, and the objects have identical values for their managed properties, this method does nothing.
The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or
dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed
property. An exception will be thrown if any required properties are not present and those properties were not defined
with default values.
When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
properties defined in the model.
@param realm The Realm which should own the object.
@param value The value used to populate the object.
@see `defaultPropertyValues`, `primaryKey`
*/
+ (instancetype)createOrUpdateInRealm:(RLMRealm *)realm withValue:(id)value;
#pragma mark - Properties
/**
The Realm which manages the object, or `nil` if the object is unmanaged.
*/
@property (nonatomic, readonly, nullable) RLMRealm *realm;
/**
The object schema which lists the managed properties for the object.
*/
@property (nonatomic, readonly) RLMObjectSchema *objectSchema;
/**
Indicates if the object can no longer be accessed because it is now invalid.
An object can no longer be accessed if the object has been deleted from the Realm that manages it, or
if `invalidate` is called on that Realm.
*/
@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;
#pragma mark - Customizing your Objects
/**
Returns an array of property names for properties which should be indexed.
Only string, integer, boolean, and `NSDate` properties are supported.
@return An array of property names.
*/
+ (NSArray<NSString *> *)indexedProperties;
/**
Override this method to specify the default values to be used for each property.
@return A dictionary mapping property names to their default values.
*/
+ (nullable NSDictionary *)defaultPropertyValues;
/**
Override this method to specify the name of a property to be used as the primary key.
Only properties of types `RLMPropertyTypeString` and `RLMPropertyTypeInt` can be designated as the primary key.
Primary key properties enforce uniqueness for each value whenever the property is set, which incurs minor overhead.
Indexes are created automatically for primary key properties.
@return The name of the property designated as the primary key.
*/
+ (nullable NSString *)primaryKey;
/**
Override this method to specify the names of properties to ignore. These properties will not be managed by the Realm
that manages the object.
@return An array of property names to ignore.
*/
+ (nullable NSArray<NSString *> *)ignoredProperties;
/**
Override this method to specify the names of properties that are non-optional (i.e. cannot be assigned a `nil` value).
By default, all properties of a type whose values can be set to `nil` are considered optional properties.
To require that an object in a Realm always store a non-`nil` value for a property,
add the name of the property to the array returned from this method.
Properties of `RLMObject` type cannot be non-optional. Array and `NSNumber` properties
can be non-optional, but there is no reason to do so: arrays do not support storing nil, and
if you want a non-optional number you should instead use the primitive type.
@return An array of property names that are required.
*/
+ (NSArray<NSString *> *)requiredProperties;
/**
Override this method to provide information related to properties containing linking objects.
Each property of type `RLMLinkingObjects` must have a key in the dictionary returned by this method consisting
of the property name. The corresponding value must be an instance of `RLMPropertyDescriptor` that describes the class
and property that the property is linked to.
return @{ @"owners": [RLMPropertyDescriptor descriptorWithClass:Owner.class propertyName:@"dogs"] };
@return A dictionary mapping property names to `RLMPropertyDescriptor` instances.
*/
+ (NSDictionary<NSString *, RLMPropertyDescriptor *> *)linkingObjectsProperties;
#pragma mark - Getting & Querying Objects from the Default Realm
/**
Returns all objects of this object type from the default Realm.
@return An `RLMResults` containing all objects of this type in the default Realm.
*/
+ (RLMResults *)allObjects;
/**
Returns all objects of this object type matching the given predicate from the default Realm.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return An `RLMResults` containing all objects of this type in the default Realm that match the given predicate.
*/
+ (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...;
/// :nodoc:
+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
/**
Returns all objects of this object type matching the given predicate from the default Realm.
@param predicate The predicate with which to filter the objects.
@return An `RLMResults` containing all objects of this type in the default Realm that match the given predicate.
*/
+ (RLMResults *)objectsWithPredicate:(nullable NSPredicate *)predicate;
/**
Retrieves the single instance of this object type with the given primary key from the default Realm.
Returns the object from the default Realm which has the given primary key, or
`nil` if the object does not exist. This is slightly faster than the otherwise
equivalent `[[SubclassName objectsWhere:@"primaryKeyPropertyName = %@", key] firstObject]`.
This method requires that `primaryKey` be overridden on the receiving subclass.
@return An object of this object type, or `nil` if an object with the given primary key does not exist.
@see `-primaryKey`
*/
+ (nullable instancetype)objectForPrimaryKey:(nullable id)primaryKey;
#pragma mark - Querying Specific Realms
/**
Returns all objects of this object type from the specified Realm.
@param realm The Realm to query.
@return An `RLMResults` containing all objects of this type in the specified Realm.
*/
+ (RLMResults *)allObjectsInRealm:(RLMRealm *)realm;
/**
Returns all objects of this object type matching the given predicate from the specified Realm.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@param realm The Realm to query.
@return An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate.
*/
+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ...;
/// :nodoc:
+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args;
/**
Returns all objects of this object type matching the given predicate from the specified Realm.
@param predicate A predicate to use to filter the elements.
@param realm The Realm to query.
@return An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate.
*/
+ (RLMResults *)objectsInRealm:(RLMRealm *)realm withPredicate:(nullable NSPredicate *)predicate;
/**
Retrieves the single instance of this object type with the given primary key from the specified Realm.
Returns the object from the specified Realm which has the given primary key, or
`nil` if the object does not exist. This is slightly faster than the otherwise
equivalent `[[SubclassName objectsInRealm:realm where:@"primaryKeyPropertyName = %@", key] firstObject]`.
This method requires that `primaryKey` be overridden on the receiving subclass.
@return An object of this object type, or `nil` if an object with the given primary key does not exist.
@see `-primaryKey`
*/
+ (nullable instancetype)objectInRealm:(RLMRealm *)realm forPrimaryKey:(nullable id)primaryKey;
#pragma mark - Notifications
/**
A callback block for `RLMObject` notifications.
If the object is deleted from the managing Realm, the block is called with
`deleted` set to `YES` and the other two arguments are `nil`. The block will
never be called again after this.
If the object is modified, the block will be called with `deleted` set to
`NO`, a `nil` error, and an array of `RLMPropertyChange` objects which
indicate which properties of the objects were modified.
If an error occurs, `deleted` will be `NO`, `changes` will be `nil`, and
`error` will include information about the error. The block will never be
called again after an error occurs.
*/
typedef void (^RLMObjectChangeBlock)(BOOL deleted,
NSArray<RLMPropertyChange *> *_Nullable changes,
NSError *_Nullable error);
/**
Registers a block to be called each time the object changes.
The block will be asynchronously called after each write transaction which
deletes the object or modifies any of the managed properties of the object,
including self-assignments that set a property to its existing value.
For write transactions performed on different threads or in differen
processes, the block will be called when the managing Realm is
(auto)refreshed to a version including the changes, while for local write
transactions it will be called at some point in the future after the write
transaction is committed.
Notifications are delivered via the standard run loop, and so can't be
delivered while the run loop is blocked by other activity. When notifications
can't be delivered instantly, multiple notifications may be coalesced into a
single notification.
Unlike with `RLMArray` and `RLMResults`, there is no "initial" callback made
after you add a new notification block.
Only objects which are managed by a Realm can be observed in this way. You
must retain the returned token for as long as you want updates to be sent to
the block. To stop receiving updates, call `stop` on the token.
It is safe to capture a strong reference to the observed object within the
callback block. There is no retain cycle due to that the callback is retained
by the returned token and not by the object itself.
@warning This method cannot be called during a write transaction, when the
containing Realm is read-only, or on an unmanaged object.
@param block The block to be called whenever a change occurs.
@return A token which must be held for as long as you want updates to be delivered.
*/
- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block;
#pragma mark - Other Instance Methods
/**
Returns YES if another Realm object instance points to the same object as the receiver in the Realm managing
the receiver.
For object types with a primary, key, `isEqual:` is overridden to use this method (along with a corresponding
implementation for `hash`).
@param object The object to compare the receiver to.
@return Whether the object represents the same object as the receiver.
*/
- (BOOL)isEqualToObject:(RLMObject *)object;
#pragma mark - Dynamic Accessors
/// :nodoc:
- (nullable id)objectForKeyedSubscript:(NSString *)key;
/// :nodoc:
- (void)setObject:(nullable id)obj forKeyedSubscript:(NSString *)key;
@end
/**
Information about a specific property which changed in an `RLMObject` change notification.
*/
@interface RLMPropertyChange : NSObject
/**
The name of the property which changed.
*/
@property (nonatomic, readonly, strong) NSString *name;
/**
The value of the property before the change occurred. This will always be `nil`
if the change happened on the same thread as the notification and for `RLMArray`
properties.
For object properties this will give the object which was previously linked to,
but that object will have its new values and not the values it had before the
changes. This means that `previousValue` may be a deleted object, and you will
need to check `invalidated` before accessing any of its properties.
*/
@property (nonatomic, readonly, strong, nullable) id previousValue;
/**
The value of the property after the change occurred. This will always be `nil`
for `RLMArray` properties.
*/
@property (nonatomic, readonly, strong, nullable) id value;
@end
#pragma mark - RLMArray Property Declaration
/**
Properties on `RLMObject`s of type `RLMArray` must have an associated type. A type is associated
with an `RLMArray` property by defining a protocol for the object type that the array should contain.
To define the protocol for an object, you can use the macro RLM_ARRAY_TYPE:
RLM_ARRAY_TYPE(ObjectType)
...
@property RLMArray<ObjectType *><ObjectType> *arrayOfObjectTypes;
*/
#define RLM_ARRAY_TYPE(RLM_OBJECT_SUBCLASS)\
@protocol RLM_OBJECT_SUBCLASS <NSObject> \
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,43 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class RLMRealm;
@class RLMSchema;
@class RLMObjectSchema;
/// :nodoc:
@interface RLMObjectBase : NSObject
@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
+ (NSString *)className;
// Returns whether the class is included in the default set of classes managed by a Realm.
+ (BOOL)shouldIncludeInDefaultSchema;
+ (nullable NSString *)_realmObjectName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,82 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Realm/RLMObject.h>
@class RLMObjectSchema, RLMRealm;
NS_ASSUME_NONNULL_BEGIN
/**
Returns the Realm that manages the object, if one exists.
@warning This function is useful only in specialized circumstances, for example, when building components
that integrate with Realm. If you are simply building an app on Realm, it is
recommended to retrieve the Realm that manages the object via `RLMObject`.
@param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
@return The Realm which manages this object. Returns `nil `for unmanaged objects.
*/
FOUNDATION_EXTERN RLMRealm * _Nullable RLMObjectBaseRealm(RLMObjectBase * _Nullable object);
/**
Returns an `RLMObjectSchema` which describes the managed properties of the object.
@warning This function is useful only in specialized circumstances, for example, when building components
that integrate with Realm. If you are simply building an app on Realm, it is
recommended to retrieve `objectSchema` via `RLMObject`.
@param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
@return The object schema which lists the managed properties for the object.
*/
FOUNDATION_EXTERN RLMObjectSchema * _Nullable RLMObjectBaseObjectSchema(RLMObjectBase * _Nullable object);
/**
Returns the object corresponding to a key value.
@warning This function is useful only in specialized circumstances, for example, when building components
that integrate with Realm. If you are simply building an app on Realm, it is
recommended to retrieve key values via `RLMObject`.
@warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object.
@param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
@param key The name of the property.
@return The object for the property requested.
*/
FOUNDATION_EXTERN id _Nullable RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key);
/**
Sets a value for a key on the object.
@warning This function is useful only in specialized circumstances, for example, when building components
that integrate with Realm. If you are simply building an app on Realm, it is
recommended to set key values via `RLMObject`.
@warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object.
@param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`.
@param key The name of the property.
@param obj The object to set as the value of the key.
*/
FOUNDATION_EXTERN void RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key, id _Nullable obj);
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,72 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class RLMProperty;
/**
This class represents Realm model object schemas.
When using Realm, `RLMObjectSchema` instances allow performing migrations and
introspecting the database's schema.
Object schemas map to tables in the core database.
*/
@interface RLMObjectSchema : NSObject<NSCopying>
#pragma mark - Properties
/**
An array of `RLMProperty` instances representing the managed properties of a class described by the schema.
@see `RLMProperty`
*/
@property (nonatomic, readonly, copy) NSArray<RLMProperty *> *properties;
/**
The name of the class the schema describes.
*/
@property (nonatomic, readonly) NSString *className;
/**
The property which serves as the primary key for the class the schema describes, if any.
*/
@property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty;
#pragma mark - Methods
/**
Retrieves an `RLMProperty` object by the property name.
@param propertyName The property's name.
@return An `RLMProperty` object, or `nil` if there is no property with the given name.
*/
- (nullable RLMProperty *)objectForKeyedSubscript:(NSString *)propertyName;
/**
Returns whether two `RLMObjectSchema` instances are equal.
*/
- (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,22 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#if !TARGET_OS_IPHONE
#error Attempting to use Realm's iOS framework in an OSX project.
#endif

View File

@@ -0,0 +1,121 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Realm/RLMConstants.h>
NS_ASSUME_NONNULL_BEGIN
/// :nodoc:
@protocol RLMInt
@end
/// :nodoc:
@protocol RLMBool
@end
/// :nodoc:
@protocol RLMDouble
@end
/// :nodoc:
@protocol RLMFloat
@end
/// :nodoc:
@interface NSNumber ()<RLMInt, RLMBool, RLMDouble, RLMFloat>
@end
/**
`RLMProperty` instances represent properties managed by a Realm in the context of an object schema. Such properties may
be persisted to a Realm file or computed from other data from the Realm.
When using Realm, `RLMProperty` instances allow performing migrations and introspecting the database's schema.
These property instances map to columns in the core database.
*/
@interface RLMProperty : NSObject
#pragma mark - Properties
/**
The name of the property.
*/
@property (nonatomic, readonly) NSString *name;
/**
The type of the property.
@see `RLMPropertyType`
*/
@property (nonatomic, readonly) RLMPropertyType type;
/**
Indicates whether this property is indexed.
@see `RLMObject`
*/
@property (nonatomic, readonly) BOOL indexed;
/**
For `RLMObject` and `RLMArray` properties, the name of the class of object stored in the property.
*/
@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
/**
For linking objects properties, the property name of the property the linking objects property is linked to.
*/
@property (nonatomic, readonly, copy, nullable) NSString *linkOriginPropertyName;
/**
Indicates whether this property is optional.
*/
@property (nonatomic, readonly) BOOL optional;
#pragma mark - Methods
/**
Returns whether a given property object is equal to the receiver.
*/
- (BOOL)isEqualToProperty:(RLMProperty *)property;
@end
/**
An `RLMPropertyDescriptor` instance represents a specific property on a given class.
*/
@interface RLMPropertyDescriptor : NSObject
/**
Creates and returns a property descriptor.
@param objectClass The class of this property descriptor.
@param propertyName The name of this property descriptor.
*/
+ (instancetype)descriptorWithClass:(Class)objectClass propertyName:(NSString *)propertyName;
/// The class of the property.
@property (nonatomic, readonly) Class objectClass;
/// The name of the property.
@property (nonatomic, readonly) NSString *propertyName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,620 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "RLMConstants.h"
@class RLMRealmConfiguration, RLMObject, RLMSchema, RLMMigration, RLMNotificationToken, RLMThreadSafeReference;
NS_ASSUME_NONNULL_BEGIN
/**
An `RLMRealm` instance (also referred to as "a Realm") represents a Realm
database.
Realms can either be stored on disk (see `+[RLMRealm realmWithURL:]`) or in
memory (see `RLMRealmConfiguration`).
`RLMRealm` instances are cached internally, and constructing equivalent `RLMRealm`
objects (for example, by using the same path or identifier) multiple times on a single thread
within a single iteration of the run loop will normally return the same
`RLMRealm` object.
If you specifically want to ensure an `RLMRealm` instance is
destroyed (for example, if you wish to open a Realm, check some property, and
then possibly delete the Realm file and re-open it), place the code which uses
the Realm within an `@autoreleasepool {}` and ensure you have no other
strong references to it.
@warning `RLMRealm` instances are not thread safe and cannot be shared across
threads or dispatch queues. Trying to do so will cause an exception to be thrown.
You must call this method on each thread you want
to interact with the Realm on. For dispatch queues, this means that you must
call it in each block which is dispatched, as a queue is not guaranteed to run
all of its blocks on the same thread.
*/
@interface RLMRealm : NSObject
#pragma mark - Creating & Initializing a Realm
/**
Obtains an instance of the default Realm.
The default Realm is used by the `RLMObject` class methods
which do not take an `RLMRealm` parameter, but is otherwise not special. The
default Realm is persisted as *default.realm* under the *Documents* directory of
your Application on iOS, and in your application's *Application Support*
directory on OS X.
The default Realm is created using the default `RLMRealmConfiguration`, which
can be changed via `+[RLMRealmConfiguration setDefaultConfiguration:]`.
@return The default `RLMRealm` instance for the current thread.
*/
+ (instancetype)defaultRealm;
/**
Obtains an `RLMRealm` instance with the given configuration.
@param configuration A configuration object to use when creating the Realm.
@param error If an error occurs, upon return contains an `NSError` object
that describes the problem. If you are not interested in
possible errors, pass in `NULL`.
@return An `RLMRealm` instance.
*/
+ (nullable instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error;
/**
Obtains an `RLMRealm` instance persisted at a specified file URL.
@param fileURL The local URL of the file the Realm should be saved at.
@return An `RLMRealm` instance.
*/
+ (instancetype)realmWithURL:(NSURL *)fileURL;
/**
The `RLMSchema` used by the Realm.
*/
@property (nonatomic, readonly) RLMSchema *schema;
/**
Indicates if the Realm is currently engaged in a write transaction.
@warning Do not simply check this property and then start a write transaction whenever an object needs to be
created, updated, or removed. Doing so might cause a large number of write transactions to be created,
degrading performance. Instead, always prefer performing multiple updates during a single transaction.
*/
@property (nonatomic, readonly) BOOL inWriteTransaction;
/**
The `RLMRealmConfiguration` object that was used to create this `RLMRealm` instance.
*/
@property (nonatomic, readonly) RLMRealmConfiguration *configuration;
/**
Indicates if this Realm contains any objects.
*/
@property (nonatomic, readonly) BOOL isEmpty;
#pragma mark - Notifications
/**
The type of a block to run whenever the data within the Realm is modified.
@see `-[RLMRealm addNotificationBlock:]`
*/
typedef void (^RLMNotificationBlock)(RLMNotification notification, RLMRealm *realm);
#pragma mark - Receiving Notification when a Realm Changes
/**
Adds a notification handler for changes in this Realm, and returns a notification token.
Notification handlers are called after each write transaction is committed,
either on the current thread or other threads.
Handler blocks are called on the same thread that they were added on, and may
only be added on threads which are currently within a run loop. Unless you are
specifically creating and running a run loop on a background thread, this will
normally only be the main thread.
The block has the following definition:
typedef void(^RLMNotificationBlock)(RLMNotification notification, RLMRealm *realm);
It receives the following parameters:
- `NSString` \***notification**: The name of the incoming notification. See
`RLMRealmNotification` for information on what
notifications are sent.
- `RLMRealm` \***realm**: The Realm for which this notification occurred.
@param block A block which is called to process Realm notifications.
@return A token object which must be retained as long as you wish to continue
receiving change notifications.
*/
- (RLMNotificationToken *)addNotificationBlock:(RLMNotificationBlock)block __attribute__((warn_unused_result));
#pragma mark - Transactions
#pragma mark - Writing to a Realm
/**
Begins a write transaction on the Realm.
Only one write transaction can be open at a time for each Realm file. Write
transactions cannot be nested, and trying to begin a write transaction on a
Realm which is already in a write transaction will throw an exception. Calls to
`beginWriteTransaction` from `RLMRealm` instances for the same Realm file in
other threads or other processes will block until the current write transaction
completes or is cancelled.
Before beginning the write transaction, `beginWriteTransaction` updates the
`RLMRealm` instance to the latest Realm version, as if `refresh` had been
called, and generates notifications if applicable. This has no effect if the
Realm was already up to date.
It is rarely a good idea to have write transactions span multiple cycles of
the run loop, but if you do wish to do so you will need to ensure that the
Realm participating in the write transaction is kept alive until the write
transaction is committed.
*/
- (void)beginWriteTransaction;
/**
Commits all write operations in the current write transaction, and ends the
transaction.
After saving the changes, all notification blocks registered on this specific
`RLMRealm` instance are invoked synchronously. Notification blocks registered
on other threads or on collections are invoked asynchronously. If you do not
want to receive a specific notification for this write tranaction, see
`commitWriteTransactionWithoutNotifying:error:`.
This method can fail if there is insufficient disk space available to save the
writes made, or due to unexpected i/o errors. This version of the method throws
an exception when errors occur. Use the version with a `NSError` out parameter
instead if you wish to handle errors.
@warning This method may only be called during a write transaction.
*/
- (void)commitWriteTransaction NS_SWIFT_UNAVAILABLE("");
/**
Commits all write operations in the current write transaction, and ends the
transaction.
After saving the changes, all notification blocks registered on this specific
`RLMRealm` instance are invoked synchronously. Notification blocks registered
on other threads or on collections are invoked asynchronously. If you do not
want to receive a specific notification for this write tranaction, see
`commitWriteTransactionWithoutNotifying:error:`.
This method can fail if there is insufficient disk space available to save the
writes made, or due to unexpected i/o errors.
@warning This method may only be called during a write transaction.
@param error If an error occurs, upon return contains an `NSError` object
that describes the problem. If you are not interested in
possible errors, pass in `NULL`.
@return Whether the transaction succeeded.
*/
- (BOOL)commitWriteTransaction:(NSError **)error;
/**
Commits all write operations in the current write transaction, without
notifying specific notification blocks of the changes.
After saving the changes, all notification blocks registered on this specific
`RLMRealm` instance are invoked synchronously. Notification blocks registered
on other threads or on collections are scheduled to be invoked asynchronously.
You can skip notifiying specific notification blocks about the changes made
in this write transaction by passing in their associated notification tokens.
This is primarily useful when the write transaction is saving changes already
made in the UI and you do not want to have the notification block attempt to
re-apply the same changes.
The tokens passed to this method must be for notifications for this specific
`RLMRealm` instance. Notifications for different threads cannot be skipped
using this method.
This method can fail if there is insufficient disk space available to save the
writes made, or due to unexpected i/o errors.
@warning This method may only be called during a write transaction.
@param tokens An array of notification tokens which were returned from adding
callbacks which you do not want to be notified for the changes
made in this write transaction.
@param error If an error occurs, upon return contains an `NSError` object
that describes the problem. If you are not interested in
possible errors, pass in `NULL`.
@return Whether the transaction succeeded.
*/
- (BOOL)commitWriteTransactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens error:(NSError **)error;
/**
Reverts all writes made during the current write transaction and ends the transaction.
This rolls back all objects in the Realm to the state they were in at the
beginning of the write transaction, and then ends the transaction.
This restores the data for deleted objects, but does not revive invalidated
object instances. Any `RLMObject`s which were added to the Realm will be
invalidated rather than becoming unmanaged.
Given the following code:
ObjectType *oldObject = [[ObjectType objectsWhere:@"..."] firstObject];
ObjectType *newObject = [[ObjectType alloc] init];
[realm beginWriteTransaction];
[realm addObject:newObject];
[realm deleteObject:oldObject];
[realm cancelWriteTransaction];
Both `oldObject` and `newObject` will return `YES` for `isInvalidated`,
but re-running the query which provided `oldObject` will once again return
the valid object.
KVO observers on any objects which were modified during the transaction will
be notified about the change back to their initial values, but no other
notifcations are produced by a cancelled write transaction.
@warning This method may only be called during a write transaction.
*/
- (void)cancelWriteTransaction;
/**
Performs actions contained within the given block inside a write transaction.
@see `[RLMRealm transactionWithBlock:error:]`
*/
- (void)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block NS_SWIFT_UNAVAILABLE("");
/**
Performs actions contained within the given block inside a write transaction.
Write transactions cannot be nested, and trying to execute a write transaction
on a Realm which is already participating in a write transaction will throw an
exception. Calls to `transactionWithBlock:` from `RLMRealm` instances in other
threads will block until the current write transaction completes.
Before beginning the write transaction, `transactionWithBlock:` updates the
`RLMRealm` instance to the latest Realm version, as if `refresh` had been called, and
generates notifications if applicable. This has no effect if the Realm
was already up to date.
@param block The block containing actions to perform.
@param error If an error occurs, upon return contains an `NSError` object
that describes the problem. If you are not interested in
possible errors, pass in `NULL`.
@return Whether the transaction succeeded.
*/
- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error;
/**
Updates the Realm and outstanding objects managed by the Realm to point to the
most recent data.
If the version of the Realm is actually changed, Realm and collection
notifications will be sent to reflect the changes. This may take some time, as
collection notifications are prepared on a background thread. As a result,
calling this method on the main thread is not advisable.
@return Whether there were any updates for the Realm. Note that `YES` may be
returned even if no data actually changed.
*/
- (BOOL)refresh;
/**
Set this property to `YES` to automatically update this Realm when changes
happen in other threads.
If set to `YES` (the default), changes made on other threads will be reflected
in this Realm on the next cycle of the run loop after the changes are
committed. If set to `NO`, you must manually call `-refresh` on the Realm to
update it to get the latest data.
Note that by default, background threads do not have an active run loop and you
will need to manually call `-refresh` in order to update to the latest version,
even if `autorefresh` is set to `YES`.
Even with this property enabled, you can still call `-refresh` at any time to
update the Realm before the automatic refresh would occur.
Write transactions will still always advance a Realm to the latest version and
produce local notifications on commit even if autorefresh is disabled.
Disabling `autorefresh` on a Realm without any strong references to it will not
have any effect, and `autorefresh` will revert back to `YES` the next time the
Realm is created. This is normally irrelevant as it means that there is nothing
to refresh (as managed `RLMObject`s, `RLMArray`s, and `RLMResults` have strong
references to the Realm that manages them), but it means that setting
`RLMRealm.defaultRealm.autorefresh = NO` in
`application:didFinishLaunchingWithOptions:` and only later storing Realm
objects will not work.
Defaults to `YES`.
*/
@property (nonatomic) BOOL autorefresh;
/**
Writes a compacted and optionally encrypted copy of the Realm to the given local URL.
The destination file cannot already exist.
Note that if this method is called from within a write transaction, the
*current* data is written, not the data from the point when the previous write
transaction was committed.
@param fileURL Local URL to save the Realm to.
@param key Optional 64-byte encryption key to encrypt the new file with.
@param error If an error occurs, upon return contains an `NSError` object
that describes the problem. If you are not interested in
possible errors, pass in `NULL`.
@return `YES` if the Realm was successfully written to disk, `NO` if an error occurred.
*/
- (BOOL)writeCopyToURL:(NSURL *)fileURL encryptionKey:(nullable NSData *)key error:(NSError **)error;
/**
Invalidates all `RLMObject`s, `RLMResults`, `RLMLinkingObjects`, and `RLMArray`s managed by the Realm.
A Realm holds a read lock on the version of the data accessed by it, so
that changes made to the Realm on different threads do not modify or delete the
data seen by this Realm. Calling this method releases the read lock,
allowing the space used on disk to be reused by later write transactions rather
than growing the file. This method should be called before performing long
blocking operations on a background thread on which you previously read data
from the Realm which you no longer need.
All `RLMObject`, `RLMResults` and `RLMArray` instances obtained from this
`RLMRealm` instance on the current thread are invalidated. `RLMObject`s and `RLMArray`s
cannot be used. `RLMResults` will become empty. The Realm itself remains valid,
and a new read transaction is implicitly begun the next time data is read from the Realm.
Calling this method multiple times in a row without reading any data from the
Realm, or before ever reading any data from the Realm, is a no-op. This method
may not be called on a read-only Realm.
*/
- (void)invalidate;
#pragma mark - Accessing Objects
/**
Returns the same object as the one referenced when the `RLMThreadSafeReference` was first created,
but resolved for the current Realm for this thread. Returns `nil` if this object was deleted after
the reference was created.
@param reference The thread-safe reference to the thread-confined object to resolve in this Realm.
@warning A `RLMThreadSafeReference` object must be resolved at most once.
Failing to resolve a `RLMThreadSafeReference` will result in the source version of the
Realm being pinned until the reference is deallocated.
An exception will be thrown if a reference is resolved more than once.
@warning Cannot call within a write transaction.
@note Will refresh this Realm if the source Realm was at a later version than this one.
@see `+[RLMThreadSafeReference referenceWithThreadConfined:]`
*/
- (nullable id)resolveThreadSafeReference:(RLMThreadSafeReference *)reference
NS_REFINED_FOR_SWIFT;
#pragma mark - Adding and Removing Objects from a Realm
/**
Adds an object to the Realm.
Once added, this object is considered to be managed by the Realm. It can be retrieved
using the `objectsWhere:` selectors on `RLMRealm` and on subclasses of `RLMObject`.
When added, all child relationships referenced by this object will also be added to
the Realm if they are not already in it.
If the object or any related objects are already being managed by a different Realm
an exception will be thrown. Use `-[RLMObject createInRealm:withObject:]` to insert a copy of a managed object
into a different Realm.
The object to be added must be valid and cannot have been previously deleted
from a Realm (i.e. `isInvalidated` must be `NO`).
@warning This method may only be called during a write transaction.
@param object The object to be added to this Realm.
*/
- (void)addObject:(RLMObject *)object;
/**
Adds all the objects in a collection to the Realm.
This is the equivalent of calling `addObject:` for every object in a collection.
@warning This method may only be called during a write transaction.
@param array An enumerable object such as `NSArray` or `RLMResults` which contains objects to be added to
the Realm.
@see `addObject:`
*/
- (void)addObjects:(id<NSFastEnumeration>)array;
/**
Adds or updates an existing object into the Realm.
The object provided must have a designated primary key. If no objects exist in the Realm
with the same primary key value, the object is inserted. Otherwise, the existing object is
updated with any changed values.
As with `addObject:`, the object cannot already be managed by a different
Realm. Use `-[RLMObject createOrUpdateInRealm:withValue:]` to copy values to
a different Realm.
@warning This method may only be called during a write transaction.
@param object The object to be added or updated.
*/
- (void)addOrUpdateObject:(RLMObject *)object;
/**
Adds or updates all the objects in a collection into the Realm.
This is the equivalent of calling `addOrUpdateObject:` for every object in a collection.
@warning This method may only be called during a write transaction.
@param array An `NSArray`, `RLMArray`, or `RLMResults` of `RLMObject`s (or subclasses) to be added to the Realm.
@see `addOrUpdateObject:`
*/
- (void)addOrUpdateObjectsFromArray:(id)array;
/**
Deletes an object from the Realm. Once the object is deleted it is considered invalidated.
@warning This method may only be called during a write transaction.
@param object The object to be deleted.
*/
- (void)deleteObject:(RLMObject *)object;
/**
Deletes one or more objects from the Realm.
This is the equivalent of calling `deleteObject:` for every object in a collection.
@warning This method may only be called during a write transaction.
@param array An `RLMArray`, `NSArray`, or `RLMResults` of `RLMObject`s (or subclasses) to be deleted.
@see `deleteObject:`
*/
- (void)deleteObjects:(id)array;
/**
Deletes all objects from the Realm.
@warning This method may only be called during a write transaction.
@see `deleteObject:`
*/
- (void)deleteAllObjects;
#pragma mark - Migrations
/**
The type of a migration block used to migrate a Realm.
@param migration A `RLMMigration` object used to perform the migration. The
migration object allows you to enumerate and alter any
existing objects which require migration.
@param oldSchemaVersion The schema version of the Realm being migrated.
*/
typedef void (^RLMMigrationBlock)(RLMMigration *migration, uint64_t oldSchemaVersion);
/**
Returns the schema version for a Realm at a given local URL.
@param fileURL Local URL to a Realm file.
@param key 64-byte key used to encrypt the file, or `nil` if it is unencrypted.
@param error If an error occurs, upon return contains an `NSError` object
that describes the problem. If you are not interested in
possible errors, pass in `NULL`.
@return The version of the Realm at `fileURL`, or `RLMNotVersioned` if the version cannot be read.
*/
+ (uint64_t)schemaVersionAtURL:(NSURL *)fileURL encryptionKey:(nullable NSData *)key error:(NSError **)error
NS_REFINED_FOR_SWIFT;
/**
Performs the given Realm configuration's migration block on a Realm at the given path.
This method is called automatically when opening a Realm for the first time and does
not need to be called explicitly. You can choose to call this method to control
exactly when and how migrations are performed.
@param configuration The Realm configuration used to open and migrate the Realm.
@return The error that occurred while applying the migration, if any.
@see RLMMigration
*/
+ (nullable NSError *)migrateRealm:(RLMRealmConfiguration *)configuration
__deprecated_msg("Use `performMigrationForConfiguration:error:`") NS_REFINED_FOR_SWIFT;
/**
Performs the given Realm configuration's migration block on a Realm at the given path.
This method is called automatically when opening a Realm for the first time and does
not need to be called explicitly. You can choose to call this method to control
exactly when and how migrations are performed.
@param configuration The Realm configuration used to open and migrate the Realm.
@return The error that occurred while applying the migration, if any.
@see RLMMigration
*/
+ (BOOL)performMigrationForConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error;
#pragma mark - Unavailable Methods
/**
RLMRealm instances are cached internally by Realm and cannot be created directly.
Use `+[RLMRealm defaultRealm]`, `+[RLMRealm realmWithConfiguration:error:]` or
`+[RLMRealm realmWithURL]` to obtain a reference to an RLMRealm.
*/
- (instancetype)init __attribute__((unavailable("Use +defaultRealm, +realmWithConfiguration: or +realmWithURL:.")));
/**
RLMRealm instances are cached internally by Realm and cannot be created directly.
Use `+[RLMRealm defaultRealm]`, `+[RLMRealm realmWithConfiguration:error:]` or
`+[RLMRealm realmWithURL]` to obtain a reference to an RLMRealm.
*/
+ (instancetype)new __attribute__((unavailable("Use +defaultRealm, +realmWithConfiguration: or +realmWithURL:.")));
@end
/**
A token which is returned from methods which subscribe to changes to a Realm.
Change subscriptions in Realm return an `RLMNotificationToken` instance,
which can be used to unsubscribe from the changes. You must store a strong
reference to the token for as long as you want to continue to receive notifications.
When you wish to stop, call the `-stop` method. Notifications are also stopped if
the token is deallocated.
*/
@interface RLMNotificationToken : NSObject
/// Stops notifications for the change subscription that returned this token.
- (void)stop;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,42 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Realm/RLMRealmConfiguration.h>
#import "RLMSyncUtil.h"
@class RLMSyncConfiguration;
/// :nodoc:
@interface RLMRealmConfiguration (Sync)
NS_ASSUME_NONNULL_BEGIN
/**
A configuration object representing configuration state for Realms intended to sync with a Realm Object Server.
This property is mutually exclusive with both `inMemoryIdentifier` and `fileURL`; setting one will nil out the other
two.
@see `RLMSyncConfiguration`
*/
@property (nullable, nonatomic) RLMSyncConfiguration *syncConfiguration;
NS_ASSUME_NONNULL_END
@end

View File

@@ -0,0 +1,99 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Realm/RLMRealm.h>
NS_ASSUME_NONNULL_BEGIN
/**
An `RLMRealmConfiguration` instance describes the different options used to
create an instance of a Realm.
`RLMRealmConfiguration` instances are just plain `NSObject`s. Unlike `RLMRealm`s
and `RLMObject`s, they can be freely shared between threads as long as you do not
mutate them.
Creating configuration objects for class subsets (by setting the
`objectClasses` property) can be expensive. Because of this, you will normally want to
cache and reuse a single configuration object for each distinct configuration rather than
creating a new object each time you open a Realm.
*/
@interface RLMRealmConfiguration : NSObject<NSCopying>
#pragma mark - Default Configuration
/**
Returns the default configuration used to create Realms when no other
configuration is explicitly specified (i.e. `+[RLMRealm defaultRealm]`).
@return The default Realm configuration.
*/
+ (instancetype)defaultConfiguration;
/**
Sets the default configuration to the given `RLMRealmConfiguration`.
@param configuration The new default Realm configuration.
*/
+ (void)setDefaultConfiguration:(RLMRealmConfiguration *)configuration;
#pragma mark - Properties
/// The local URL of the Realm file. Mutually exclusive with `inMemoryIdentifier`.
@property (nonatomic, copy, nullable) NSURL *fileURL;
/// A string used to identify a particular in-memory Realm. Mutually exclusive with `fileURL`.
@property (nonatomic, copy, nullable) NSString *inMemoryIdentifier;
/// A 64-byte key to use to encrypt the data, or `nil` if encryption is not enabled.
@property (nonatomic, copy, nullable) NSData *encryptionKey;
/// Whether to open the Realm in read-only mode.
///
/// This is required to be able to open Realm files which are not writeable or
/// are in a directory which is not writeable. This should only be used on files
/// which will not be modified by anyone while they are open, and not just to
/// get a read-only view of a file which may be written to by another thread or
/// process. Opening in read-only mode requires disabling Realm's reader/writer
/// coordination, so committing a write transaction from another process will
/// result in crashes.
@property (nonatomic) BOOL readOnly;
/// The current schema version.
@property (nonatomic) uint64_t schemaVersion;
/// The block which migrates the Realm to the current version.
@property (nonatomic, copy, nullable) RLMMigrationBlock migrationBlock;
/**
Whether to recreate the Realm file with the provided schema if a migration is required.
This is the case when the stored schema differs from the provided schema or
the stored schema version differs from the version on this configuration.
Setting this property to `YES` deletes the file if a migration would otherwise be required or executed.
@note Setting this property to `YES` doesn't disable file format migrations.
*/
@property (nonatomic) BOOL deleteRealmIfMigrationNeeded;
/// The classes managed by the Realm.
@property (nonatomic, copy, nullable) NSArray *objectClasses;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,118 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Realm/RLMRealm.h>
#import <Realm/RLMObjectSchema.h>
#import <Realm/RLMProperty.h>
@class RLMResults;
NS_ASSUME_NONNULL_BEGIN
@interface RLMRealm (Dynamic)
#pragma mark - Getting Objects from a Realm
/**
Returns all objects of a given type from the Realm.
@warning This method is useful only in specialized circumstances, for example, when building components
that integrate with Realm. The preferred way to get objects of a single class is to use the class
methods on `RLMObject`.
@param className The name of the `RLMObject` subclass to retrieve on (e.g. `MyClass.className`).
@return An `RLMResults` containing all objects in the Realm of the given type.
@see `+[RLMObject allObjects]`
*/
- (RLMResults *)allObjects:(NSString *)className;
/**
Returns all objects matching the given predicate from the Realm.
@warning This method is useful only in specialized circumstances, for example, when building components
that integrate with Realm. The preferred way to get objects of a single class is to use the class
methods on `RLMObject`.
@param className The type of objects you are looking for (name of the class).
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return An `RLMResults` containing results matching the given predicate.
@see `+[RLMObject objectsWhere:]`
*/
- (RLMResults *)objects:(NSString *)className where:(NSString *)predicateFormat, ...;
/**
Returns all objects matching the given predicate from the Realm.
@warning This method is useful only in specialized circumstances, for example, when building components
that integrate with Realm. The preferred way to get objects of a single class is to use the class
methods on `RLMObject`.
@param className The type of objects you are looking for (name of the class).
@param predicate The predicate with which to filter the objects.
@return An `RLMResults` containing results matching the given predicate.
@see `+[RLMObject objectsWhere:]`
*/
- (RLMResults *)objects:(NSString *)className withPredicate:(NSPredicate *)predicate;
/**
Returns the object of the given type with the given primary key from the Realm.
@warning This method is useful only in specialized circumstances, for example, when building components
that integrate with Realm. The preferred way to get an object of a single class is to use the class
methods on `RLMObject`.
@param className The class name for the object you are looking for.
@param primaryKey The primary key value for the object you are looking for.
@return An object, or `nil` if an object with the given primary key does not exist.
@see `+[RLMObject objectForPrimaryKey:]`
*/
- (nullable RLMObject *)objectWithClassName:(NSString *)className forPrimaryKey:(id)primaryKey;
/**
Creates an `RLMObject` instance of type `className` in the Realm, and populates it using a given object.
The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or
dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed
property. An exception will be thrown if any required properties are not present and those properties were not defined
with default values.
When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
properties defined in the model.
@warning This method is useful only in specialized circumstances, for example, when building components
that integrate with Realm. If you are simply building an app on Realm, it is recommended to
use `[RLMObject createInDefaultRealmWithValue:]`.
@param value The value used to populate the object.
@return An `RLMObject` instance of type `className`.
*/
-(RLMObject *)createObject:(NSString *)className withValue:(id)value;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,343 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Realm/RLMCollection.h>
NS_ASSUME_NONNULL_BEGIN
@class RLMObject, RLMRealm, RLMNotificationToken;
/**
`RLMResults` is an auto-updating container type in Realm returned from object
queries. It represents the results of the query in the form of a collection of objects.
`RLMResults` can be queried using the same predicates as `RLMObject` and `RLMArray`,
and you can chain queries to further filter results.
`RLMResults` always reflect the current state of the Realm on the current thread,
including during write transactions on the current thread. The one exception to
this is when using `for...in` fast enumeration, which will always enumerate
over the objects which matched the query when the enumeration is begun, even if
some of them are deleted or modified to be excluded by the filter during the
enumeration.
`RLMResults` are lazily evaluated the first time they are accessed; they only
run queries when the result of the query is requested. This means that
chaining several temporary `RLMResults` to sort and filter your data does not
perform any extra work processing the intermediate state.
Once the results have been evaluated or a notification block has been added,
the results are eagerly kept up-to-date, with the work done to keep them
up-to-date done on a background thread whenever possible.
`RLMResults` cannot be directly instantiated.
*/
@interface RLMResults<RLMObjectType: RLMObject *> : NSObject<RLMCollection, NSFastEnumeration>
#pragma mark - Properties
/**
The number of objects in the results collection.
*/
@property (nonatomic, readonly, assign) NSUInteger count;
/**
The class name (i.e. type) of the `RLMObject`s contained in the results collection.
*/
@property (nonatomic, readonly, copy) NSString *objectClassName;
/**
The Realm which manages this results collection.
*/
@property (nonatomic, readonly) RLMRealm *realm;
/**
Indicates if the results collection is no longer valid.
The results collection becomes invalid if `invalidate` is called on the containing `realm`.
An invalidated results collection can be accessed, but will always be empty.
*/
@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated;
#pragma mark - Accessing Objects from an RLMResults
/**
Returns the object at the index specified.
@param index The index to look up.
@return An `RLMObject` of the type contained in the results collection.
*/
- (RLMObjectType)objectAtIndex:(NSUInteger)index;
/**
Returns the first object in the results collection.
Returns `nil` if called on an empty results collection.
@return An `RLMObject` of the type contained in the results collection.
*/
- (nullable RLMObjectType)firstObject;
/**
Returns the last object in the results collection.
Returns `nil` if called on an empty results collection.
@return An `RLMObject` of the type contained in the results collection.
*/
- (nullable RLMObjectType)lastObject;
#pragma mark - Querying Results
/**
Returns the index of an object in the results collection.
Returns `NSNotFound` if the object is not found in the results collection.
@param object An object (of the same type as returned from the `objectClassName` selector).
*/
- (NSUInteger)indexOfObject:(RLMObjectType)object;
/**
Returns the index of the first object in the results collection matching the predicate.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return The index of the object, or `NSNotFound` if the object is not found in the results collection.
*/
- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...;
/// :nodoc:
- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args;
/**
Returns the index of the first object in the results collection matching the predicate.
@param predicate The predicate with which to filter the objects.
@return The index of the object, or `NSNotFound` if the object is not found in the results collection.
*/
- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate;
/**
Returns all the objects matching the given predicate in the results collection.
@param predicateFormat A predicate format string, optionally followed by a variable number of arguments.
@return An `RLMResults` of objects that match the given predicate.
*/
- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat, ...;
/// :nodoc:
- (RLMResults<RLMObjectType> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
/**
Returns all the objects matching the given predicate in the results collection.
@param predicate The predicate with which to filter the objects.
@return An `RLMResults` of objects that match the given predicate.
*/
- (RLMResults<RLMObjectType> *)objectsWithPredicate:(NSPredicate *)predicate;
/**
Returns a sorted `RLMResults` from an existing results collection.
@param keyPath The key path to sort by.
@param ascending The direction to sort in.
@return An `RLMResults` sorted by the specified key path.
*/
- (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
/**
Returns a sorted `RLMResults` from an existing results collection.
@param property The property name to sort by.
@param ascending The direction to sort in.
@return An `RLMResults` sorted by the specified property.
*/
- (RLMResults<RLMObjectType> *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending
__deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`");
/**
Returns a sorted `RLMResults` from an existing results collection.
@param properties An array of `RLMSortDescriptor`s to sort by.
@return An `RLMResults` sorted by the specified properties.
*/
- (RLMResults<RLMObjectType> *)sortedResultsUsingDescriptors:(NSArray<RLMSortDescriptor *> *)properties;
#pragma mark - Notifications
/**
Registers a block to be called each time the results collection changes.
The block will be asynchronously called with the initial results collection,
and then called again after each write transaction which changes either any
of the objects in the results, or which objects are in the results.
The `change` parameter will be `nil` the first time the block is called.
For each call after that, it will contain information about
which rows in the results collection were added, removed or modified. If a
write transaction did not modify any objects in the results collection,
the block is not called at all. See the `RLMCollectionChange` documentation for
information on how the changes are reported and an example of updating a
`UITableView`.
If an error occurs the block will be called with `nil` for the results
parameter and a non-`nil` error. Currently the only errors that can occur are
when opening the Realm on the background worker thread.
At the time when the block is called, the `RLMResults` object will be fully
evaluated and up-to-date, and as long as you do not perform a write transaction
on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will
never perform blocking work.
Notifications are delivered via the standard run loop, and so can't be
delivered while the run loop is blocked by other activity. When
notifications can't be delivered instantly, multiple notifications may be
coalesced into a single notification. This can include the notification
with the initial results. For example, the following code performs a write
transaction immediately after adding the notification block, so there is no
opportunity for the initial notification to be delivered first. As a
result, the initial notification will reflect the state of the Realm after
the write transaction.
RLMResults<Dog *> *results = [Dog allObjects];
NSLog(@"dogs.count: %zu", dogs.count); // => 0
self.token = [results addNotificationBlock:^(RLMResults *dogs,
RLMCollectionChange *changes,
NSError *error) {
// Only fired once for the example
NSLog(@"dogs.count: %zu", dogs.count); // => 1
}];
[realm transactionWithBlock:^{
Dog *dog = [[Dog alloc] init];
dog.name = @"Rex";
[realm addObject:dog];
}];
// end of run loop execution context
You must retain the returned token for as long as you want updates to continue
to be sent to the block. To stop receiving updates, call `-stop` on the token.
@warning This method cannot be called during a write transaction, or when the
containing Realm is read-only.
@param block The block to be called whenever a change occurs.
@return A token which must be held for as long as you want updates to be delivered.
*/
- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults<RLMObjectType> *__nullable results,
RLMCollectionChange *__nullable change,
NSError *__nullable error))block __attribute__((warn_unused_result));
#pragma mark - Aggregating Property Values
/**
Returns the minimum (lowest) value of the given property among all the objects
represented by the results collection.
NSNumber *min = [results minOfProperty:@"age"];
@warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
@param property The property whose minimum value is desired. Only properties of types `int`, `float`, `double`, and
`NSDate` are supported.
@return The minimum value of the property.
*/
- (nullable id)minOfProperty:(NSString *)property;
/**
Returns the maximum (highest) value of the given property among all the objects represented by the results collection.
NSNumber *max = [results maxOfProperty:@"age"];
@warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
@param property The property whose maximum value is desired. Only properties of types `int`, `float`, `double`, and
`NSDate` are supported.
@return The maximum value of the property.
*/
- (nullable id)maxOfProperty:(NSString *)property;
/**
Returns the sum of the values of a given property over all the objects represented by the results collection.
NSNumber *sum = [results sumOfProperty:@"age"];
@warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
@param property The property whose values should be summed. Only properties of types `int`, `float`, and `double` are
supported.
@return The sum of the given property.
*/
- (NSNumber *)sumOfProperty:(NSString *)property;
/**
Returns the average value of a given property over the objects represented by the results collection.
NSNumber *average = [results averageOfProperty:@"age"];
@warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
@param property The property whose average value should be calculated. Only properties of types `int`, `float`, and
`double` are supported.
@return The average value of the given property. This will be of type `double` for both `float` and `double`
properties.
*/
- (nullable NSNumber *)averageOfProperty:(NSString *)property;
/// :nodoc:
- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index;
#pragma mark - Unavailable Methods
/**
`-[RLMResults init]` is not available because `RLMResults` cannot be created directly.
`RLMResults` can be obtained by querying a Realm.
*/
- (instancetype)init __attribute__((unavailable("RLMResults cannot be created directly")));
/**
`+[RLMResults new]` is not available because `RLMResults` cannot be created directly.
`RLMResults` can be obtained by querying a Realm.
*/
+ (instancetype)new __attribute__((unavailable("RLMResults cannot be created directly")));
@end
/**
`RLMLinkingObjects` is an auto-updating container type. It represents a collection of objects that link to its
parent object.
For more information, please see the "Inverse Relationships" section in the
[documentation](https://realm.io/docs/objc/latest/#relationships).
*/
@interface RLMLinkingObjects<RLMObjectType: RLMObject *> : RLMResults
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,77 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2014 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class RLMObjectSchema;
/**
`RLMSchema` instances represent collections of model object schemas managed by a Realm.
When using Realm, `RLMSchema` instances allow performing migrations and
introspecting the database's schema.
Schemas map to collections of tables in the core database.
*/
@interface RLMSchema : NSObject<NSCopying>
#pragma mark - Properties
/**
An `NSArray` containing `RLMObjectSchema`s for all object types in the Realm.
This property is intended to be used during migrations for dynamic introspection.
@see `RLMObjectSchema`
*/
@property (nonatomic, readonly, copy) NSArray<RLMObjectSchema *> *objectSchema;
#pragma mark - Methods
/**
Returns an `RLMObjectSchema` for the given class name in the schema.
@param className The object class name.
@return An `RLMObjectSchema` for the given class in the schema.
@see `RLMObjectSchema`
*/
- (nullable RLMObjectSchema *)schemaForClassName:(NSString *)className;
/**
Looks up and returns an `RLMObjectSchema` for the given class name in the Realm.
If there is no object of type `className` in the schema, an exception will be thrown.
@param className The object class name.
@return An `RLMObjectSchema` for the given class in this Realm.
@see `RLMObjectSchema`
*/
- (RLMObjectSchema *)objectForKeyedSubscript:(NSString *)className;
/**
Returns whether two `RLMSchema` instances are equivalent.
*/
- (BOOL)isEqualToSchema:(RLMSchema *)schema;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,60 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
@class RLMSyncUser;
NS_ASSUME_NONNULL_BEGIN
/**
A configuration object representing configuration state for a Realm which is intended to sync with a Realm Object
Server.
*/
@interface RLMSyncConfiguration : NSObject
/// The user to which the remote Realm belongs.
@property (nonatomic, readonly) RLMSyncUser *user;
/**
The URL of the remote Realm upon the Realm Object Server.
@warning The URL cannot end with `.realm`, `.realm.lock` or `.realm.management`.
*/
@property (nonatomic, readonly) NSURL *realmURL;
/**
Create a sync configuration instance.
@param user A `RLMSyncUser` that owns the Realm at the given URL.
@param url The unresolved absolute URL to the Realm on the Realm Object Server, e.g.
`realm://example.org/~/path/to/realm`. "Unresolved" means the path should
contain the wildcard marker `~`, which will automatically be filled in with
the user identity by the Realm Object Server.
*/
- (instancetype)initWithUser:(RLMSyncUser *)user realmURL:(NSURL *)url;
/// :nodoc:
- (instancetype)init __attribute__((unavailable("This type cannot be created directly")));
/// :nodoc:
+ (instancetype)new __attribute__((unavailable("This type cannot be created directly")));
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,106 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "RLMSyncUtil.h"
NS_ASSUME_NONNULL_BEGIN
/// A token representing an identity provider's credentials.
typedef NSString *RLMSyncCredentialsToken;
/// A type representing the unique identifier of a Realm Object Server identity provider.
typedef NSString *RLMIdentityProvider RLM_EXTENSIBLE_STRING_ENUM;
/// The debug identity provider, which accepts any token string and creates a user associated with that token if one
/// does not yet exist. Not enabled for Realm Object Server configured for production.
extern RLMIdentityProvider const RLMIdentityProviderDebug;
/// The username/password identity provider. User accounts are handled by the Realm Object Server directly without the
/// involvement of a third-party identity provider.
extern RLMIdentityProvider const RLMIdentityProviderUsernamePassword;
/// A Facebook account as an identity provider.
extern RLMIdentityProvider const RLMIdentityProviderFacebook;
/// A Google account as an identity provider.
extern RLMIdentityProvider const RLMIdentityProviderGoogle;
/// A CloudKit account as an identity provider.
extern RLMIdentityProvider const RLMIdentityProviderCloudKit;
/**
Opaque credentials representing a specific Realm Object Server user.
*/
@interface RLMSyncCredentials : NSObject
/// An opaque credentials token containing information that uniquely identifies a Realm Object Server user.
@property (nonatomic, readonly) RLMSyncCredentialsToken token;
/// The name of the identity provider which generated the credentials token.
@property (nonatomic, readonly) RLMIdentityProvider provider;
/// A dictionary containing additional pertinent information. In most cases this is automatically configured.
@property (nonatomic, readonly) NSDictionary<NSString *, id> *userInfo;
/**
Construct and return credentials from a Facebook account token.
*/
+ (instancetype)credentialsWithFacebookToken:(RLMSyncCredentialsToken)token;
/**
Construct and return credentials from a Google account token.
*/
+ (instancetype)credentialsWithGoogleToken:(RLMSyncCredentialsToken)token;
/**
Construct and return credentials from an CloudKit account token.
*/
+ (instancetype)credentialsWithCloudKitToken:(RLMSyncCredentialsToken)token;
/**
Construct and return credentials from a Realm Object Server username and password.
*/
+ (instancetype)credentialsWithUsername:(NSString *)username
password:(NSString *)password
register:(BOOL)shouldRegister;
/**
Construct and return special credentials representing a token that can be directly used to open a Realm. The identity
is used to uniquely identify the user across application launches.
*/
+ (instancetype)credentialsWithAccessToken:(RLMServerToken)accessToken identity:(NSString *)identity;
/**
Construct and return credentials with a custom token string, identity provider string, and optional user info. In most
cases, the convenience initializers should be used instead.
*/
- (instancetype)initWithCustomToken:(RLMSyncCredentialsToken)token
provider:(RLMIdentityProvider)provider
userInfo:(nullable NSDictionary *)userInfo NS_DESIGNATED_INITIALIZER;
/// :nodoc:
- (instancetype)init __attribute__((unavailable("RLMSyncCredentials cannot be created directly")));
/// :nodoc:
+ (instancetype)new __attribute__((unavailable("RLMSyncCredentials cannot be created directly")));
NS_ASSUME_NONNULL_END
@end

View File

@@ -0,0 +1,102 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "RLMSyncUtil.h"
@class RLMSyncSession;
/// An enum representing different levels of sync-related logging that can be configured.
typedef NS_ENUM(NSUInteger, RLMSyncLogLevel) {
/// Nothing will ever be logged.
RLMSyncLogLevelOff,
/// Only fatal errors will be logged.
RLMSyncLogLevelFatal,
/// Only errors will be logged.
RLMSyncLogLevelError,
/// Warnings and errors will be logged.
RLMSyncLogLevelWarn,
/// Information about sync events will be logged. Fewer events will be logged in order to avoid overhead.
RLMSyncLogLevelInfo,
/// Information about sync events will be logged. More events will be logged than with `RLMSyncLogLevelInfo`.
RLMSyncLogLevelDetail,
/// Log information that can aid in debugging.
///
/// - warning: Will incur a measurable performance impact.
RLMSyncLogLevelDebug,
/// Log information that can aid in debugging. More events will be logged than with `RLMSyncLogLevelDebug`.
///
/// - warning: Will incur a measurable performance impact.
RLMSyncLogLevelTrace,
/// Log information that can aid in debugging. More events will be logged than with `RLMSyncLogLevelTrace`.
///
/// - warning: Will incur a measurable performance impact.
RLMSyncLogLevelAll
};
NS_ASSUME_NONNULL_BEGIN
/// A block type representing a block which can be used to report a sync-related error to the application. If the error
/// pertains to a specific session, that session will also be passed into the block.
typedef void(^RLMSyncErrorReportingBlock)(NSError *, RLMSyncSession * _Nullable);
/**
A singleton manager which serves as a central point for sync-related configuration.
*/
@interface RLMSyncManager : NSObject
/**
An optional block which can be used to report sync-related errors to your application. Errors reported through this
mechanism are always fatal; they represent attempts to open sessions which are invalid (for example, using malformed
URLs).
*/
@property (nullable, nonatomic, copy) RLMSyncErrorReportingBlock errorHandler;
/**
A reverse-DNS string uniquely identifying this application. In most cases this is automatically set by the SDK, and
does not have to be explicitly configured.
*/
@property (nonatomic, copy) NSString *appID;
/**
Whether SSL certificate validation should be disabled. SSL certificate validation is ON by default. Setting this
property after at least one synced Realm or standalone Session has been opened is a no-op.
@warning NEVER disable certificate validation for clients and servers in production.
*/
@property (nonatomic) BOOL disableSSLValidation;
/**
The logging threshold which newly opened synced Realms will use. Defaults to `RLMSyncLogLevelInfo`. Set this before
any synced Realms are opened. Logging strings are output to ASL.
*/
@property (nonatomic) RLMSyncLogLevel logLevel;
/// The sole instance of the singleton.
+ (instancetype)sharedManager NS_REFINED_FOR_SWIFT;
/// :nodoc:
- (instancetype)init __attribute__((unavailable("RLMSyncManager cannot be created directly")));
/// :nodoc:
+ (instancetype)new __attribute__((unavailable("RLMSyncManager cannot be created directly")));
NS_ASSUME_NONNULL_END
@end

View File

@@ -0,0 +1,54 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Realm/RLMObject.h>
NS_ASSUME_NONNULL_BEGIN
/**
This model is used to reflect permissions.
It should be used in conjunction with a `RLMSyncUser`'s Permission Realm.
You can only read this Realm. Use the objects in Management Realm to
make request for modifications of permissions.
See https://realm.io/docs/realm-object-server/#permissions for general
documentation.
*/
@interface RLMSyncPermission : RLMObject
/// The date this object was last modified.
@property (readonly) NSDate *updatedAt;
/// The identity of a user affected by this permission.
@property (readonly) NSString *userId;
/// The path to the realm.
@property (readonly) NSString *path;
/// Whether the affected user is allowed to read from the Realm.
@property (readonly) BOOL mayRead;
/// Whether the affected user is allowed to write to the Realm.
@property (readonly) BOOL mayWrite;
/// Whether the affected user is allowed to manage the access rights for others.
@property (readonly) BOOL mayManage;
@end
NS_ASSUME_NONNULL_END

Some files were not shown because too many files have changed in this diff Show More