mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
Improve GRDBDemoiOS
This commit is contained in:
1 parent
4a4f259501
commit
3d21c254e5
13 files changed
+365
-381
No files matched your search
@@ -7,14 +7,13 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
56900E421BBFF7D500B815B5 /* PersonEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56900E411BBFF7D500B815B5 /* PersonEditionViewController.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
56B8F4581B4E22B200C24296 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B8F4571B4E22B200C24296 /* AppDelegate.swift */; };
|
||||
56B8F45A1B4E22B200C24296 /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B8F4591B4E22B200C24296 /* MasterViewController.swift */; };
|
||||
56B8F45C1B4E22B200C24296 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B8F45B1B4E22B200C24296 /* DetailViewController.swift */; };
|
||||
56B8F45F1B4E22B200C24296 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B8F45D1B4E22B200C24296 /* Main.storyboard */; };
|
||||
56B8F4611B4E22B200C24296 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 56B8F4601B4E22B200C24296 /* Assets.xcassets */; };
|
||||
56B8F4641B4E22B200C24296 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B8F4621B4E22B200C24296 /* LaunchScreen.storyboard */; };
|
||||
56B8F46F1B4E22B200C24296 /* GRDBDemoiOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B8F46E1B4E22B200C24296 /* GRDBDemoiOSTests.swift */; };
|
||||
56B8F47A1B4E22B200C24296 /* GRDBDemoiOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B8F4791B4E22B200C24296 /* GRDBDemoiOSUITests.swift */; };
|
||||
56B8F4991B4E23AA00C24296 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B8F4981B4E23AA00C24296 /* Person.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -54,23 +53,10 @@
|
||||
remoteGlobalIDString = 56E5D7C91B4D3FED00430942;
|
||||
remoteInfo = GRDBiOS;
|
||||
};
|
||||
56B8F46B1B4E22B200C24296 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B8F44C1B4E22B200C24296 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 56B8F4531B4E22B200C24296;
|
||||
remoteInfo = GRDBDemoiOS;
|
||||
};
|
||||
56B8F4761B4E22B200C24296 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 56B8F44C1B4E22B200C24296 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 56B8F4531B4E22B200C24296;
|
||||
remoteInfo = GRDBDemoiOS;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
56900E411BBFF7D500B815B5 /* PersonEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonEditionViewController.swift; sourceTree = "<group>"; };
|
||||
56B8F4541B4E22B200C24296 /* GRDBDemoiOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GRDBDemoiOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
56B8F4571B4E22B200C24296 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
56B8F4591B4E22B200C24296 /* MasterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterViewController.swift; sourceTree = "<group>"; };
|
||||
@@ -79,12 +65,6 @@
|
||||
56B8F4601B4E22B200C24296 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
56B8F4631B4E22B200C24296 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
56B8F4651B4E22B200C24296 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
56B8F46A1B4E22B200C24296 /* GRDBDemoiOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBDemoiOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
56B8F46E1B4E22B200C24296 /* GRDBDemoiOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GRDBDemoiOSTests.swift; sourceTree = "<group>"; };
|
||||
56B8F4701B4E22B200C24296 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
56B8F4751B4E22B200C24296 /* GRDBDemoiOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBDemoiOSUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
56B8F4791B4E22B200C24296 /* GRDBDemoiOSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GRDBDemoiOSUITests.swift; sourceTree = "<group>"; };
|
||||
56B8F47B1B4E22B200C24296 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
56B8F4871B4E235C00C24296 /* GRDB.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDB.xcodeproj; path = ../../../GRDB.xcodeproj; sourceTree = "<group>"; };
|
||||
56B8F4981B4E23AA00C24296 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@@ -97,20 +77,6 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56B8F4671B4E22B200C24296 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56B8F4721B4E22B200C24296 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@@ -125,12 +91,54 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56900E3C1BBFF2C400B815B5 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4601B4E22B200C24296 /* Assets.xcassets */,
|
||||
56B8F4621B4E22B200C24296 /* LaunchScreen.storyboard */,
|
||||
56B8F45D1B4E22B200C24296 /* Main.storyboard */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56900E3D1BBFF2DB00B815B5 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4871B4E235C00C24296 /* GRDB.xcodeproj */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56900E3E1BBFF2E900B815B5 /* Controllers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F45B1B4E22B200C24296 /* DetailViewController.swift */,
|
||||
56B8F4591B4E22B200C24296 /* MasterViewController.swift */,
|
||||
56900E411BBFF7D500B815B5 /* PersonEditionViewController.swift */,
|
||||
);
|
||||
name = Controllers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56900E3F1BBFF2F200B815B5 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4981B4E23AA00C24296 /* Person.swift */,
|
||||
);
|
||||
name = Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56900E401BBFF31800B815B5 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4651B4E22B200C24296 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56B8F44B1B4E22B200C24296 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4561B4E22B200C24296 /* GRDBDemoiOS */,
|
||||
56B8F46D1B4E22B200C24296 /* GRDBDemoiOSTests */,
|
||||
56B8F4781B4E22B200C24296 /* GRDBDemoiOSUITests */,
|
||||
56B8F4551B4E22B200C24296 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@@ -139,8 +147,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4541B4E22B200C24296 /* GRDBDemoiOS.app */,
|
||||
56B8F46A1B4E22B200C24296 /* GRDBDemoiOSTests.xctest */,
|
||||
56B8F4751B4E22B200C24296 /* GRDBDemoiOSUITests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -148,37 +154,16 @@
|
||||
56B8F4561B4E22B200C24296 /* GRDBDemoiOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4871B4E235C00C24296 /* GRDB.xcodeproj */,
|
||||
56B8F4571B4E22B200C24296 /* AppDelegate.swift */,
|
||||
56B8F4591B4E22B200C24296 /* MasterViewController.swift */,
|
||||
56B8F45B1B4E22B200C24296 /* DetailViewController.swift */,
|
||||
56B8F4981B4E23AA00C24296 /* Person.swift */,
|
||||
56B8F45D1B4E22B200C24296 /* Main.storyboard */,
|
||||
56B8F4601B4E22B200C24296 /* Assets.xcassets */,
|
||||
56B8F4621B4E22B200C24296 /* LaunchScreen.storyboard */,
|
||||
56B8F4651B4E22B200C24296 /* Info.plist */,
|
||||
56900E3E1BBFF2E900B815B5 /* Controllers */,
|
||||
56900E3F1BBFF2F200B815B5 /* Models */,
|
||||
56900E3C1BBFF2C400B815B5 /* Resources */,
|
||||
56900E3D1BBFF2DB00B815B5 /* Frameworks */,
|
||||
56900E401BBFF31800B815B5 /* Supporting Files */,
|
||||
);
|
||||
path = GRDBDemoiOS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56B8F46D1B4E22B200C24296 /* GRDBDemoiOSTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F46E1B4E22B200C24296 /* GRDBDemoiOSTests.swift */,
|
||||
56B8F4701B4E22B200C24296 /* Info.plist */,
|
||||
);
|
||||
path = GRDBDemoiOSTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56B8F4781B4E22B200C24296 /* GRDBDemoiOSUITests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56B8F4791B4E22B200C24296 /* GRDBDemoiOSUITests.swift */,
|
||||
56B8F47B1B4E22B200C24296 /* Info.plist */,
|
||||
);
|
||||
path = GRDBDemoiOSUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -200,42 +185,6 @@
|
||||
productReference = 56B8F4541B4E22B200C24296 /* GRDBDemoiOS.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
56B8F4691B4E22B200C24296 /* GRDBDemoiOSTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 56B8F4811B4E22B200C24296 /* Build configuration list for PBXNativeTarget "GRDBDemoiOSTests" */;
|
||||
buildPhases = (
|
||||
56B8F4661B4E22B200C24296 /* Sources */,
|
||||
56B8F4671B4E22B200C24296 /* Frameworks */,
|
||||
56B8F4681B4E22B200C24296 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
56B8F46C1B4E22B200C24296 /* PBXTargetDependency */,
|
||||
);
|
||||
name = GRDBDemoiOSTests;
|
||||
productName = GRDBDemoiOSTests;
|
||||
productReference = 56B8F46A1B4E22B200C24296 /* GRDBDemoiOSTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
56B8F4741B4E22B200C24296 /* GRDBDemoiOSUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 56B8F4841B4E22B200C24296 /* Build configuration list for PBXNativeTarget "GRDBDemoiOSUITests" */;
|
||||
buildPhases = (
|
||||
56B8F4711B4E22B200C24296 /* Sources */,
|
||||
56B8F4721B4E22B200C24296 /* Frameworks */,
|
||||
56B8F4731B4E22B200C24296 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
56B8F4771B4E22B200C24296 /* PBXTargetDependency */,
|
||||
);
|
||||
name = GRDBDemoiOSUITests;
|
||||
productName = GRDBDemoiOSUITests;
|
||||
productReference = 56B8F4751B4E22B200C24296 /* GRDBDemoiOSUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@@ -248,14 +197,6 @@
|
||||
56B8F4531B4E22B200C24296 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
};
|
||||
56B8F4691B4E22B200C24296 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
TestTargetID = 56B8F4531B4E22B200C24296;
|
||||
};
|
||||
56B8F4741B4E22B200C24296 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
TestTargetID = 56B8F4531B4E22B200C24296;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 56B8F44F1B4E22B200C24296 /* Build configuration list for PBXProject "GRDBDemoiOS" */;
|
||||
@@ -278,8 +219,6 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
56B8F4531B4E22B200C24296 /* GRDBDemoiOS */,
|
||||
56B8F4691B4E22B200C24296 /* GRDBDemoiOSTests */,
|
||||
56B8F4741B4E22B200C24296 /* GRDBDemoiOSUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -326,20 +265,6 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56B8F4681B4E22B200C24296 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56B8F4731B4E22B200C24296 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -350,26 +275,11 @@
|
||||
56B8F45C1B4E22B200C24296 /* DetailViewController.swift in Sources */,
|
||||
56B8F45A1B4E22B200C24296 /* MasterViewController.swift in Sources */,
|
||||
56B8F4991B4E23AA00C24296 /* Person.swift in Sources */,
|
||||
56900E421BBFF7D500B815B5 /* PersonEditionViewController.swift in Sources */,
|
||||
56B8F4581B4E22B200C24296 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56B8F4661B4E22B200C24296 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
56B8F46F1B4E22B200C24296 /* GRDBDemoiOSTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56B8F4711B4E22B200C24296 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
56B8F47A1B4E22B200C24296 /* GRDBDemoiOSUITests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
@@ -378,16 +288,6 @@
|
||||
name = GRDBiOS;
|
||||
targetProxy = 567AA8AC1B4E41CF0082C3E4 /* PBXContainerItemProxy */;
|
||||
};
|
||||
56B8F46C1B4E22B200C24296 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 56B8F4531B4E22B200C24296 /* GRDBDemoiOS */;
|
||||
targetProxy = 56B8F46B1B4E22B200C24296 /* PBXContainerItemProxy */;
|
||||
};
|
||||
56B8F4771B4E22B200C24296 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 56B8F4531B4E22B200C24296 /* GRDBDemoiOS */;
|
||||
targetProxy = 56B8F4761B4E22B200C24296 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
@@ -515,54 +415,6 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
56B8F4821B4E22B200C24296 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = GRDBDemoiOSTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOSTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GRDBDemoiOS.app/GRDBDemoiOS";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
56B8F4831B4E22B200C24296 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = GRDBDemoiOSTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOSTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GRDBDemoiOS.app/GRDBDemoiOS";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
56B8F4851B4E22B200C24296 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = GRDBDemoiOSUITests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOSUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_TARGET_NAME = GRDBDemoiOS;
|
||||
USES_XCTRUNNER = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
56B8F4861B4E22B200C24296 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = GRDBDemoiOSUITests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOSUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_TARGET_NAME = GRDBDemoiOS;
|
||||
USES_XCTRUNNER = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -584,24 +436,6 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
56B8F4811B4E22B200C24296 /* Build configuration list for PBXNativeTarget "GRDBDemoiOSTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
56B8F4821B4E22B200C24296 /* Debug */,
|
||||
56B8F4831B4E22B200C24296 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
56B8F4841B4E22B200C24296 /* Build configuration list for PBXNativeTarget "GRDBDemoiOSUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
56B8F4851B4E22B200C24296 /* Debug */,
|
||||
56B8F4861B4E22B200C24296 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 56B8F44C1B4E22B200C24296 /* Project object */;
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
import UIKit
|
||||
import GRDB
|
||||
|
||||
// The shared database queue, stored in a global.
|
||||
// It is created in AppDelegate.application(_:didFinishLaunchingWithOptions:)
|
||||
var dbQueue: DatabaseQueue!
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
let splitViewController = self.window!.rootViewController as! UISplitViewController
|
||||
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
|
||||
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
|
||||
splitViewController.delegate = self
|
||||
|
||||
// Database
|
||||
dbQueue = DatabaseQueue()
|
||||
// Connect to the database
|
||||
|
||||
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString
|
||||
let databasePath = documentsPath.stringByAppendingPathComponent("db.sqlite")
|
||||
dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
|
||||
|
||||
// Use DatabaseMigrator to setup the database
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPersons") { db in
|
||||
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY, firstName TEXT, lastName TEXT)")
|
||||
try db.execute(
|
||||
"CREATE TABLE persons (" +
|
||||
"id INTEGER PRIMARY KEY, " +
|
||||
"firstName TEXT, " +
|
||||
"lastName TEXT " +
|
||||
")")
|
||||
}
|
||||
migrator.registerMigration("addPersons") { db in
|
||||
try Person(firstName: "Arthur", lastName: "Miller").insert(db)
|
||||
@@ -29,6 +36,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||
}
|
||||
try! migrator.migrate(dbQueue)
|
||||
|
||||
|
||||
// Setup view controllers
|
||||
|
||||
let splitViewController = self.window!.rootViewController as! UISplitViewController
|
||||
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
|
||||
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
|
||||
splitViewController.delegate = self
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8076" systemVersion="14D121" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8063"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Master-->
|
||||
@@ -22,7 +22,7 @@
|
||||
<!--Detail-->
|
||||
<scene sceneID="yUG-lL-AsK">
|
||||
<objects>
|
||||
<viewController title="Detail" id="JEX-9P-axG" customClass="DetailViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController title="Detail" id="JEX-9P-axG" customClass="DetailViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="SYR-Wa-9uf"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="GAO-Cl-Wes"/>
|
||||
@@ -56,6 +56,124 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="709" y="129"/>
|
||||
</scene>
|
||||
<!--Person Edition View Controller-->
|
||||
<scene sceneID="hZT-8U-F5G">
|
||||
<objects>
|
||||
<tableViewController id="yMU-Wr-YuI" customClass="PersonEditionViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="W7Z-fg-c9y">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<sections>
|
||||
<tableViewSection id="jAm-13-xC3">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="M9a-av-50p">
|
||||
<rect key="frame" x="0.0" y="99" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="M9a-av-50p" id="z18-Cs-DYr">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="BDD-vR-uvL">
|
||||
<rect key="frame" x="106" y="11" width="479" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="yMU-Wr-YuI" id="kl9-oG-bcm"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="First Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fUF-iv-npM">
|
||||
<rect key="frame" x="15" y="11" width="83" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="BDD-vR-uvL" firstAttribute="centerY" secondItem="z18-Cs-DYr" secondAttribute="centerY" id="9Rw-U2-gEE"/>
|
||||
<constraint firstAttribute="trailing" secondItem="BDD-vR-uvL" secondAttribute="trailing" constant="15" id="nQF-Sy-r5l"/>
|
||||
<constraint firstItem="fUF-iv-npM" firstAttribute="centerY" secondItem="z18-Cs-DYr" secondAttribute="centerY" id="ofb-oL-lAk"/>
|
||||
<constraint firstItem="BDD-vR-uvL" firstAttribute="leading" secondItem="fUF-iv-npM" secondAttribute="trailing" constant="8" symbolic="YES" id="pL4-Tm-5q7"/>
|
||||
<constraint firstItem="fUF-iv-npM" firstAttribute="leading" secondItem="z18-Cs-DYr" secondAttribute="leading" constant="15" id="tBn-VL-Q7E"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="TEu-C2-7tX">
|
||||
<rect key="frame" x="0.0" y="143" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="TEu-C2-7tX" id="awh-JA-Hz6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iqx-ux-kA0">
|
||||
<rect key="frame" x="105" y="11" width="480" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="yMU-Wr-YuI" id="pIN-qZ-ntI"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Last Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7dD-VT-wdQ">
|
||||
<rect key="frame" x="15" y="11" width="82" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="iqx-ux-kA0" secondAttribute="trailing" constant="15" id="UVH-DD-pHC"/>
|
||||
<constraint firstItem="7dD-VT-wdQ" firstAttribute="centerY" secondItem="awh-JA-Hz6" secondAttribute="centerY" id="Vwn-I3-e7h"/>
|
||||
<constraint firstItem="iqx-ux-kA0" firstAttribute="centerY" secondItem="awh-JA-Hz6" secondAttribute="centerY" id="VzL-HK-apN"/>
|
||||
<constraint firstItem="iqx-ux-kA0" firstAttribute="leading" secondItem="7dD-VT-wdQ" secondAttribute="trailing" constant="8" symbolic="YES" id="fDY-Ju-iSw"/>
|
||||
<constraint firstItem="7dD-VT-wdQ" firstAttribute="leading" secondItem="awh-JA-Hz6" secondAttribute="leading" constant="15" id="j64-an-fjP"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="yMU-Wr-YuI" id="fDY-MJ-pJo"/>
|
||||
<outlet property="delegate" destination="yMU-Wr-YuI" id="Un1-A3-CJp"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" id="Rwz-Rp-lmd">
|
||||
<barButtonItem key="rightBarButtonItem" style="done" systemItem="done" id="NJu-k4-mIi">
|
||||
<connections>
|
||||
<segue destination="FMm-Lo-i3b" kind="unwind" identifier="commit" unwindAction="commitPersonEdition:" id="dkC-cp-6iC"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="firstNameTableViewCell" destination="M9a-av-50p" id="vXh-ik-bqv"/>
|
||||
<outlet property="firstNameTextField" destination="BDD-vR-uvL" id="BYU-BL-kha"/>
|
||||
<outlet property="lastNameTableViewCell" destination="TEu-C2-7tX" id="wDv-if-Gkl"/>
|
||||
<outlet property="lastNameTextField" destination="iqx-ux-kA0" id="wOu-gU-WlV"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="23u-wY-35e" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="FMm-Lo-i3b" userLabel="Exit" sceneMemberID="exit"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2301" y="-630"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="GQC-vK-8JG">
|
||||
<objects>
|
||||
<navigationController id="IJV-AU-xKl" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="y7A-ea-ZFU">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="yMU-Wr-YuI" kind="relationship" relationship="rootViewController" id="1PW-hN-E5f"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4jR-xV-SBm" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1481" y="-630"/>
|
||||
</scene>
|
||||
<!--Split View Controller-->
|
||||
<scene sceneID="Nki-YV-4Qg">
|
||||
<objects>
|
||||
@@ -73,21 +191,21 @@
|
||||
<!--Master-->
|
||||
<scene sceneID="smW-Zh-WAh">
|
||||
<objects>
|
||||
<tableViewController title="Master" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableViewController title="Master" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" style="IBUITableViewCellStyleDefault" id="WCw-Qf-5nD">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="43"/>
|
||||
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
@@ -97,7 +215,7 @@
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<segue destination="vC3-pB-5Vb" kind="showDetail" identifier="showDetail" id="6S0-TO-JiA"/>
|
||||
<segue destination="vC3-pB-5Vb" kind="showDetail" identifier="showPerson" id="vhz-QC-pld"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
@@ -107,7 +225,15 @@
|
||||
<outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Master" id="Zdf-7t-Un8"/>
|
||||
<navigationItem key="navigationItem" title="Master" id="Zdf-7t-Un8">
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="add" id="q2y-Jp-QNL">
|
||||
<connections>
|
||||
<segue destination="IJV-AU-xKl" kind="popoverPresentation" identifier="editNewPerson" popoverAnchorBarButtonItem="q2y-Jp-QNL" id="KcV-Yc-DEu">
|
||||
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
|
||||
</segue>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
@@ -130,6 +256,6 @@
|
||||
</scene>
|
||||
</scenes>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="6S0-TO-JiA"/>
|
||||
<segue reference="vhz-QC-pld"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
@@ -1,26 +1,24 @@
|
||||
import UIKit
|
||||
|
||||
class DetailViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var detailDescriptionLabel: UILabel!
|
||||
|
||||
var person: Person? {
|
||||
var person: Person! {
|
||||
didSet {
|
||||
self.configureView()
|
||||
}
|
||||
}
|
||||
|
||||
func configureView() {
|
||||
if let person = self.person {
|
||||
if let label = self.detailDescriptionLabel {
|
||||
label.text = person.fullName
|
||||
}
|
||||
guard isViewLoaded() else {
|
||||
return
|
||||
}
|
||||
detailDescriptionLabel.text = person.fullName
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.configureView()
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
configureView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import UIKit
|
||||
|
||||
class MasterViewController: UITableViewController {
|
||||
|
||||
var detailViewController: DetailViewController? = nil
|
||||
var persons = [Person]()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
self.navigationItem.leftBarButtonItem = self.editButtonItem()
|
||||
|
||||
if let split = self.splitViewController {
|
||||
let controllers = split.viewControllers
|
||||
self.detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
|
||||
@@ -18,33 +14,60 @@ class MasterViewController: UITableViewController {
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
persons = dbQueue.inDatabase { db in
|
||||
Person.fetchAll(db, "SELECT * FROM persons ORDER BY firstName, lastName")
|
||||
}
|
||||
// Reload persons, and the tableView
|
||||
reloadPersons()
|
||||
tableView.reloadData()
|
||||
|
||||
self.clearsSelectionOnViewWillAppear = self.splitViewController!.collapsed
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
// MARK: - Segues
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
if segue.identifier == "showDetail" {
|
||||
if let indexPath = self.tableView.indexPathForSelectedRow {
|
||||
let person = persons[indexPath.row]
|
||||
let controller = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController
|
||||
controller.person = person
|
||||
controller.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem()
|
||||
controller.navigationItem.leftItemsSupplementBackButton = true
|
||||
}
|
||||
|
||||
func reloadPersons() {
|
||||
persons = dbQueue.inDatabase { db in
|
||||
Person.fetchAll(db, "SELECT * FROM persons ORDER BY LOWER(firstName), LOWER(lastName)")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Table View
|
||||
|
||||
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return 1
|
||||
|
||||
|
||||
// MARK: - Segues
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
if segue.identifier == "showPerson" {
|
||||
let detailViewController = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController
|
||||
detailViewController.person = persons[self.tableView.indexPathForSelectedRow!.row]
|
||||
detailViewController.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem()
|
||||
detailViewController.navigationItem.leftItemsSupplementBackButton = true
|
||||
}
|
||||
else if segue.identifier == "editNewPerson" {
|
||||
let personEditionViewController = (segue.destinationViewController as! UINavigationController).topViewController as! PersonEditionViewController
|
||||
personEditionViewController.person = Person()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Unwind action: commit person edition
|
||||
@IBAction func commitPersonEdition(segue: UIStoryboardSegue) {
|
||||
let personEditionViewController = segue.sourceViewController as! PersonEditionViewController
|
||||
let person = personEditionViewController.person
|
||||
|
||||
// Ignore person with no name
|
||||
guard (person.firstName ?? "").characters.count > 0 || (person.lastName ?? "").characters.count > 0 else {
|
||||
return
|
||||
}
|
||||
|
||||
// Save person
|
||||
try! dbQueue.inDatabase { db in
|
||||
try person.save(db)
|
||||
}
|
||||
|
||||
// Reload persons, and insert a cell.
|
||||
reloadPersons()
|
||||
let index = persons.indexOf { $0.id == person.id }!
|
||||
tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 0)], withRowAnimation: .Automatic)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Table View
|
||||
|
||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return persons.count
|
||||
}
|
||||
@@ -58,13 +81,14 @@ class MasterViewController: UITableViewController {
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
|
||||
// Delete the person
|
||||
let person = persons[indexPath.row]
|
||||
try! dbQueue.inTransaction { db in
|
||||
try person.delete(db)
|
||||
return .Commit
|
||||
}
|
||||
persons.removeAtIndex(indexPath.row)
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import UIKit
|
||||
|
||||
class PersonEditionViewController: UITableViewController, UITextFieldDelegate {
|
||||
@IBOutlet weak var firstNameTableViewCell: UITableViewCell!
|
||||
@IBOutlet weak var firstNameTextField: UITextField!
|
||||
@IBOutlet weak var lastNameTableViewCell: UITableViewCell!
|
||||
@IBOutlet weak var lastNameTextField: UITextField!
|
||||
|
||||
// The edited person
|
||||
var person: Person!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Initializes textFields with the person's names
|
||||
firstNameTextField.text = person.firstName
|
||||
lastNameTextField.text = person.lastName
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
// Auto focus firstName
|
||||
firstNameTextField.becomeFirstResponder()
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||
// Tapping a cell selects its text fields.
|
||||
if indexPath == tableView.indexPathForCell(firstNameTableViewCell) {
|
||||
firstNameTextField.becomeFirstResponder()
|
||||
} else if indexPath == tableView.indexPathForCell(lastNameTableViewCell) {
|
||||
lastNameTextField.becomeFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
func textFieldShouldReturn(textField: UITextField) -> Bool {
|
||||
// Tapping Return key focuses next text field.
|
||||
if textField == firstNameTextField {
|
||||
lastNameTextField.becomeFirstResponder()
|
||||
} else {
|
||||
textField.resignFirstResponder()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func textFieldDidEndEditing(textField: UITextField) {
|
||||
// Update person when text field ends editing.
|
||||
if textField == firstNameTextField {
|
||||
person.firstName = textField.text
|
||||
} else if textField == lastNameTextField {
|
||||
person.lastName = textField.text
|
||||
}
|
||||
}
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
// About to cancel or commit: end editing.
|
||||
// This dismisses the keyboard early, and apply pending changes through
|
||||
// textFieldDidEndEditing(_).
|
||||
view.endEditing(true)
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
class GRDBDemoiOSTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measureBlock() {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,27 +0,0 @@
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class GRDBDemoiOSUITests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
|
||||
XCUIApplication().launch()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// Use recording to get started writing UI tests.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,24 @@
|
||||
GRDBDemoiOS
|
||||
===========
|
||||
|
||||
This application runs an universal (iPhone + iPad) application that displays an editable list of persons.
|
||||
|
||||
To see usage of GRDB, check the following files:
|
||||
|
||||
- [AppDelegate.swift](GRDBDemoiOS/AppDelegate.swift)
|
||||
|
||||
AppDelegate sets up a global dbQueue that is accessible in the whole application.
|
||||
|
||||
It uses migrations to initialize the database.
|
||||
|
||||
- [MasterViewController.swift](GRDBDemoiOS/MasterViewController.swift)
|
||||
|
||||
MasterViewController is responsible for displaying the list of persons in a table view, deleting persons, and present a person edition form.
|
||||
|
||||
- [Person.swift](GRDBDemoiOS/Person.swift)
|
||||
|
||||
Person is a simple Record subclass.
|
||||
|
||||
- [DetailViewController.swift](GRDBDemoiOS/DetailViewController.swift) and [PersonEditionViewController.swift](GRDBDemoiOS/PersonEditionViewController.swift)
|
||||
|
||||
Those two view controllers display and edit a Person, in total isolation from the database.
|
||||
@@ -133,10 +133,10 @@ To fiddle with the library, open the `GRDB.xcworkspace` workspace: it contains a
|
||||
|
||||
**[Application Tools](#application-tools)**
|
||||
|
||||
- [Migrations](#migrations)
|
||||
- [Database Changes Observation](#database-changes-observation)
|
||||
- [RowConvertible Protocol](#rowconvertible-protocol)
|
||||
- [Records](#records)
|
||||
- [Migrations](#migrations): Transform your database as your application evolves.
|
||||
- [Database Changes Observation](#database-changes-observation): A robust way to perform post-commit and post-rollback actions.
|
||||
- [RowConvertible Protocol](#rowconvertible-protocol): Turn database rows into handy types, without sacrificing peformance.
|
||||
- [Records](#records): CRUD operations and changes tracking.
|
||||
- [Core Methods](#core-methods)
|
||||
- [Fetching Records](#fetching-records)
|
||||
- [Tables and Primary Keys](#tables-and-primary-keys)
|
||||
@@ -145,6 +145,10 @@ To fiddle with the library, open the `GRDB.xcworkspace` workspace: it contains a
|
||||
- [Record Errors](#record-errors)
|
||||
- [Advice](#advice)
|
||||
|
||||
**Sample Code**
|
||||
|
||||
- [GRDBDemoiOS](DemoApps/GRDBDemoiOS): A sample iOS application.
|
||||
|
||||
|
||||
SQLite API
|
||||
==========
|
||||
|
||||
Reference in new issue
Block a user