mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-18 15:07:00 +01:00
created an asynchronous method for adding sqlite store to handle asynchronous migrations. note that this commit breaks previous usage of DataStack.addSQLiteStore(...), which is now renamed to addSQLiteStoreAndWait(...)
This commit is contained in:
@@ -24,12 +24,14 @@
|
||||
B566E32A1B117B1F00F4F0C6 /* StackSetupDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B566E3291B117B1F00F4F0C6 /* StackSetupDemoViewController.swift */; };
|
||||
B566E3321B11DF3200F4F0C6 /* UserAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = B566E3311B11DF3200F4F0C6 /* UserAccount.swift */; };
|
||||
B56964C91B20AC780075EE4A /* CustomLoggerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56964C81B20AC780075EE4A /* CustomLoggerViewController.swift */; };
|
||||
B56964D71B231AE90075EE4A /* StackSetupDemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B56964D51B231AE90075EE4A /* StackSetupDemo.xcdatamodeld */; };
|
||||
B56964DA1B231BCA0075EE4A /* MaleAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56964D91B231BCA0075EE4A /* MaleAccount.swift */; };
|
||||
B56964DC1B231BCB0075EE4A /* FemaleAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56964DB1B231BCB0075EE4A /* FemaleAccount.swift */; };
|
||||
B56964DF1B2321E30075EE4A /* MigrationDemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B56964DD1B2321E30075EE4A /* MigrationDemo.xcdatamodeld */; };
|
||||
B583A9201AF5F542001F76AF /* CoreStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B583A91B1AF5F4F4001F76AF /* CoreStore.framework */; };
|
||||
B583A9211AF5F542001F76AF /* CoreStore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B583A91B1AF5F4F4001F76AF /* CoreStore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
B5D9C9191B20AB1900E64F0E /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5D9C9181B20AB1900E64F0E /* GCDKit.framework */; };
|
||||
B5D9C91A1B20AB1900E64F0E /* GCDKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5D9C9181B20AB1900E64F0E /* GCDKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
B5E7240F1B11F993006FB83F /* TwitterAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E7240E1B11F993006FB83F /* TwitterAccount.swift */; };
|
||||
B5E724111B11F994006FB83F /* FacebookAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E724101B11F994006FB83F /* FacebookAccount.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -98,10 +100,13 @@
|
||||
B566E3291B117B1F00F4F0C6 /* StackSetupDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StackSetupDemoViewController.swift; sourceTree = "<group>"; };
|
||||
B566E3311B11DF3200F4F0C6 /* UserAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserAccount.swift; sourceTree = "<group>"; };
|
||||
B56964C81B20AC780075EE4A /* CustomLoggerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomLoggerViewController.swift; sourceTree = "<group>"; };
|
||||
B56964D61B231AE90075EE4A /* StackSetupDemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = StackSetupDemo.xcdatamodel; sourceTree = "<group>"; };
|
||||
B56964D91B231BCA0075EE4A /* MaleAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaleAccount.swift; sourceTree = "<group>"; };
|
||||
B56964DB1B231BCB0075EE4A /* FemaleAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FemaleAccount.swift; sourceTree = "<group>"; };
|
||||
B56964DE1B2321E30075EE4A /* MigrationDemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemo.xcdatamodel; sourceTree = "<group>"; };
|
||||
B56964E01B2326F30075EE4A /* MigrationDemoV2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MigrationDemoV2.xcdatamodel; sourceTree = "<group>"; };
|
||||
B583A9141AF5F4F3001F76AF /* CoreStore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CoreStore.xcodeproj; path = ../CoreStore.xcodeproj; sourceTree = "<group>"; };
|
||||
B5D9C9181B20AB1900E64F0E /* GCDKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GCDKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B5E7240E1B11F993006FB83F /* TwitterAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TwitterAccount.swift; sourceTree = "<group>"; };
|
||||
B5E724101B11F994006FB83F /* FacebookAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacebookAccount.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -180,6 +185,8 @@
|
||||
B54AAD5A1AF4D26E00848AE0 /* Images.xcassets */,
|
||||
B54AAD5C1AF4D26E00848AE0 /* LaunchScreen.xib */,
|
||||
B54AAD501AF4D26E00848AE0 /* CoreStoreDemo.xcdatamodeld */,
|
||||
B56964D51B231AE90075EE4A /* StackSetupDemo.xcdatamodeld */,
|
||||
B56964DD1B2321E30075EE4A /* MigrationDemo.xcdatamodeld */,
|
||||
B54AAD4C1AF4D26E00848AE0 /* Supporting Files */,
|
||||
);
|
||||
path = CoreStoreDemo;
|
||||
@@ -196,8 +203,8 @@
|
||||
B566E3271B117AE700F4F0C6 /* Stack Setup Demo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B5E724101B11F994006FB83F /* FacebookAccount.swift */,
|
||||
B5E7240E1B11F993006FB83F /* TwitterAccount.swift */,
|
||||
B56964DB1B231BCB0075EE4A /* FemaleAccount.swift */,
|
||||
B56964D91B231BCA0075EE4A /* MaleAccount.swift */,
|
||||
B566E3311B11DF3200F4F0C6 /* UserAccount.swift */,
|
||||
B566E3291B117B1F00F4F0C6 /* StackSetupDemoViewController.swift */,
|
||||
);
|
||||
@@ -318,19 +325,21 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B52977DD1B120F3B003D50A5 /* TransactionsDemoViewController.swift in Sources */,
|
||||
B56964DF1B2321E30075EE4A /* MigrationDemo.xcdatamodeld in Sources */,
|
||||
B52977E41B121635003D50A5 /* Place.swift in Sources */,
|
||||
B503FAE01AFDC71700F90881 /* ObjectObserverDemoViewController.swift in Sources */,
|
||||
B52977D91B120B80003D50A5 /* ObserversViewController.swift in Sources */,
|
||||
B56964C91B20AC780075EE4A /* CustomLoggerViewController.swift in Sources */,
|
||||
B566E32A1B117B1F00F4F0C6 /* StackSetupDemoViewController.swift in Sources */,
|
||||
B5E724111B11F994006FB83F /* FacebookAccount.swift in Sources */,
|
||||
B5E7240F1B11F993006FB83F /* TwitterAccount.swift in Sources */,
|
||||
B56964DA1B231BCA0075EE4A /* MaleAccount.swift in Sources */,
|
||||
B566E3321B11DF3200F4F0C6 /* UserAccount.swift in Sources */,
|
||||
B54AAD521AF4D26E00848AE0 /* CoreStoreDemo.xcdatamodeld in Sources */,
|
||||
B503FAE11AFDC71700F90881 /* Palette.swift in Sources */,
|
||||
B503FAE21AFDC71700F90881 /* PaletteTableViewCell.swift in Sources */,
|
||||
B503FADF1AFDC71700F90881 /* ObjectListObserverDemoViewController.swift in Sources */,
|
||||
B54AAD4F1AF4D26E00848AE0 /* AppDelegate.swift in Sources */,
|
||||
B56964D71B231AE90075EE4A /* StackSetupDemo.xcdatamodeld in Sources */,
|
||||
B56964DC1B231BCB0075EE4A /* FemaleAccount.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -516,6 +525,27 @@
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
B56964D51B231AE90075EE4A /* StackSetupDemo.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
B56964D61B231AE90075EE4A /* StackSetupDemo.xcdatamodel */,
|
||||
);
|
||||
currentVersion = B56964D61B231AE90075EE4A /* StackSetupDemo.xcdatamodel */;
|
||||
path = StackSetupDemo.xcdatamodeld;
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
B56964DD1B2321E30075EE4A /* MigrationDemo.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
B56964E01B2326F30075EE4A /* MigrationDemoV2.xcdatamodel */,
|
||||
B56964DE1B2321E30075EE4A /* MigrationDemo.xcdatamodel */,
|
||||
);
|
||||
currentVersion = B56964E01B2326F30075EE4A /* MigrationDemoV2.xcdatamodel */;
|
||||
path = MigrationDemo.xcdatamodeld;
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
/* End XCVersionGroup section */
|
||||
};
|
||||
rootObject = B54AAD411AF4D26E00848AE0 /* Project object */;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
@@ -13,26 +13,14 @@
|
||||
<attribute name="subtitle" optional="YES" attributeType="String" syncable="YES"/>
|
||||
<attribute name="title" optional="YES" attributeType="String" syncable="YES"/>
|
||||
</entity>
|
||||
<entity name="UserAccount" representedClassName="CoreStoreDemo.UserAccount" syncable="YES">
|
||||
<attribute name="accountType" optional="YES" attributeType="String" syncable="YES"/>
|
||||
<attribute name="friends" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
|
||||
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
|
||||
</entity>
|
||||
<configuration name="ObservingDemo">
|
||||
<memberEntity name="Palette"/>
|
||||
</configuration>
|
||||
<configuration name="SetupDemo_Jane">
|
||||
<memberEntity name="UserAccount"/>
|
||||
</configuration>
|
||||
<configuration name="SetupDemo_John">
|
||||
<memberEntity name="UserAccount"/>
|
||||
</configuration>
|
||||
<configuration name="TransactionsDemo">
|
||||
<memberEntity name="Place"/>
|
||||
</configuration>
|
||||
<elements>
|
||||
<element name="Palette" positionX="261" positionY="189" width="128" height="105"/>
|
||||
<element name="Place" positionX="261" positionY="225" width="128" height="105"/>
|
||||
<element name="UserAccount" positionX="261" positionY="216" width="128" height="90"/>
|
||||
</elements>
|
||||
</model>
|
||||
@@ -14,7 +14,7 @@ private struct Static {
|
||||
|
||||
static let palettes: ManagedObjectListController<Palette> = {
|
||||
|
||||
CoreStore.addSQLiteStore(
|
||||
CoreStore.addSQLiteStoreAndWait(
|
||||
"ColorsDemo.sqlite",
|
||||
configuration: "ObservingDemo",
|
||||
resetStoreOnMigrationFailure: true
|
||||
|
||||
@@ -30,7 +30,7 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
|
||||
|
||||
super.viewDidLoad()
|
||||
|
||||
self.dataStack.addSQLiteStore("emptyStore.sqlite")
|
||||
self.dataStack.addSQLiteStoreAndWait("emptyStore.sqlite")
|
||||
CoreStore.logger = self
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
|
||||
}
|
||||
|
||||
case .Some(1):
|
||||
self.dataStack.addSQLiteStore("emptyStore.sqlite", configuration: "invalidStore")
|
||||
self.dataStack.addSQLiteStoreAndWait("emptyStore.sqlite", configuration: "invalidStore")
|
||||
|
||||
case .Some(2):
|
||||
self.dataStack.beginAsynchronous { (transaction) -> Void in
|
||||
|
||||
@@ -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>_XCCurrentVersionName</key>
|
||||
<string>MigrationDemoV2.xcdatamodel</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7701" systemVersion="14D136" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
|
||||
<entity name="Organism" syncable="YES"/>
|
||||
<elements>
|
||||
<element name="Organism" positionX="-36" positionY="9" width="128" height="45"/>
|
||||
</elements>
|
||||
</model>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7701" systemVersion="14D136" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
|
||||
<entity name="Organism" syncable="YES"/>
|
||||
<elements>
|
||||
<element name="Organism" positionX="-36" positionY="9" width="128" height="45"/>
|
||||
</elements>
|
||||
</model>
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// FacebookAccount.swift
|
||||
// CoreStoreDemo
|
||||
//
|
||||
// Created by John Rommel Estropia on 2015/05/24.
|
||||
// Copyright (c) 2015 John Rommel Estropia. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
|
||||
// MARK: - FacebookAccount
|
||||
|
||||
class FacebookAccount: TwitterAccount { }
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// FemaleAccount.swift
|
||||
// CoreStoreDemo
|
||||
//
|
||||
// Created by John Rommel Estropia on 2015/06/06.
|
||||
// Copyright (c) 2015 John Rommel Estropia. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
class FemaleAccount: UserAccount {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// MaleAccount.swift
|
||||
// CoreStoreDemo
|
||||
//
|
||||
// Created by John Rommel Estropia on 2015/06/06.
|
||||
// Copyright (c) 2015 John Rommel Estropia. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
class MaleAccount: UserAccount {
|
||||
|
||||
|
||||
}
|
||||
@@ -12,34 +12,33 @@ import CoreStore
|
||||
|
||||
private struct Static {
|
||||
|
||||
static let johnConfiguration = "SetupDemo_John"
|
||||
static let janeConfiguration = "SetupDemo_Jane"
|
||||
static let maleConfiguration = "MaleAccounts"
|
||||
static let femaleConfiguration = "FemaleAccounts"
|
||||
|
||||
static let facebookStack: DataStack = {
|
||||
|
||||
let dataStack = DataStack(modelName: "CoreStoreDemo")
|
||||
dataStack.addSQLiteStore(
|
||||
"AccountsDemo_FB_John.sqlite",
|
||||
configuration: johnConfiguration,
|
||||
let dataStack = DataStack(modelName: "StackSetupDemo")
|
||||
dataStack.addSQLiteStoreAndWait(
|
||||
"AccountsDemo_FB_Male.sqlite",
|
||||
configuration: maleConfiguration,
|
||||
resetStoreOnMigrationFailure: true
|
||||
)
|
||||
dataStack.addSQLiteStore(
|
||||
"AccountsDemo_FB_Jane.sqlite",
|
||||
configuration: janeConfiguration,
|
||||
dataStack.addSQLiteStoreAndWait(
|
||||
"AccountsDemo_FB_Female.sqlite",
|
||||
configuration: femaleConfiguration,
|
||||
resetStoreOnMigrationFailure: true
|
||||
)
|
||||
|
||||
dataStack.beginSynchronous { (transaction) -> Void in
|
||||
|
||||
transaction.deleteAll(From<UserAccount>(johnConfiguration))
|
||||
transaction.deleteAll(From<UserAccount>(janeConfiguration))
|
||||
transaction.deleteAll(From(UserAccount))
|
||||
|
||||
let account1 = transaction.create(Into<UserAccount>(johnConfiguration))
|
||||
let account1 = transaction.create(Into<MaleAccount>(maleConfiguration))
|
||||
account1.accountType = "Facebook"
|
||||
account1.name = "John Smith HCD"
|
||||
account1.friends = 42
|
||||
|
||||
let account2 = transaction.create(Into<UserAccount>(janeConfiguration))
|
||||
let account2 = transaction.create(Into<FemaleAccount>(femaleConfiguration))
|
||||
account2.accountType = "Facebook"
|
||||
account2.name = "Jane Doe HCD"
|
||||
account2.friends = 314
|
||||
@@ -52,29 +51,28 @@ private struct Static {
|
||||
|
||||
static let twitterStack: DataStack = {
|
||||
|
||||
let dataStack = DataStack(modelName: "CoreStoreDemo")
|
||||
dataStack.addSQLiteStore(
|
||||
"AccountsDemo_TW_John.sqlite",
|
||||
configuration: johnConfiguration,
|
||||
let dataStack = DataStack(modelName: "StackSetupDemo")
|
||||
dataStack.addSQLiteStoreAndWait(
|
||||
"AccountsDemo_TW_Male.sqlite",
|
||||
configuration: maleConfiguration,
|
||||
resetStoreOnMigrationFailure: true
|
||||
)
|
||||
dataStack.addSQLiteStore(
|
||||
"AccountsDemo_TW_Jane.sqlite",
|
||||
configuration: janeConfiguration,
|
||||
dataStack.addSQLiteStoreAndWait(
|
||||
"AccountsDemo_TW_Female.sqlite",
|
||||
configuration: femaleConfiguration,
|
||||
resetStoreOnMigrationFailure: true
|
||||
)
|
||||
|
||||
dataStack.beginSynchronous { (transaction) -> Void in
|
||||
|
||||
transaction.deleteAll(From<UserAccount>(johnConfiguration))
|
||||
transaction.deleteAll(From<UserAccount>(janeConfiguration))
|
||||
transaction.deleteAll(From(UserAccount))
|
||||
|
||||
let account1 = transaction.create(Into<UserAccount>(johnConfiguration))
|
||||
let account1 = transaction.create(Into<MaleAccount>(maleConfiguration))
|
||||
account1.accountType = "Twitter"
|
||||
account1.name = "#johnsmith_hcd"
|
||||
account1.friends = 7
|
||||
|
||||
let account2 = transaction.create(Into<UserAccount>(janeConfiguration))
|
||||
let account2 = transaction.create(Into<FemaleAccount>(femaleConfiguration))
|
||||
account2.accountType = "Twitter"
|
||||
account2.name = "#janedoe_hcd"
|
||||
account2.friends = 100
|
||||
@@ -94,14 +92,8 @@ private struct Static {
|
||||
class StackSetupDemoViewController: UITableViewController {
|
||||
|
||||
let accounts = [
|
||||
[
|
||||
Static.facebookStack.fetchOne(From<UserAccount>(Static.johnConfiguration))!,
|
||||
Static.facebookStack.fetchOne(From<UserAccount>(Static.janeConfiguration))!
|
||||
],
|
||||
[
|
||||
Static.twitterStack.fetchOne(From<UserAccount>(Static.johnConfiguration))!,
|
||||
Static.twitterStack.fetchOne(From<UserAccount>(Static.janeConfiguration))!
|
||||
]
|
||||
Static.facebookStack.fetchAll(From(UserAccount)) ?? [],
|
||||
Static.twitterStack.fetchAll(From(UserAccount)) ?? []
|
||||
]
|
||||
|
||||
|
||||
@@ -169,11 +161,11 @@ class StackSetupDemoViewController: UITableViewController {
|
||||
switch section {
|
||||
|
||||
case 0:
|
||||
let count = Static.facebookStack.fetchCount(From(UserAccount)) ?? 0
|
||||
let count = self.accounts[section].count
|
||||
return "Facebook Accounts (\(count) users)"
|
||||
|
||||
case 1:
|
||||
let count = Static.twitterStack.fetchCount(From(UserAccount)) ?? 0
|
||||
let count = self.accounts[section].count
|
||||
return "Twitter Accounts (\(count) users)"
|
||||
|
||||
default:
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// TwitterAccount.swift
|
||||
// CoreStoreDemo
|
||||
//
|
||||
// Created by John Rommel Estropia on 2015/05/24.
|
||||
// Copyright (c) 2015 John Rommel Estropia. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
|
||||
// MARK: - TwitterAccount
|
||||
|
||||
class TwitterAccount: UserAccount { }
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7701" systemVersion="14D136" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
|
||||
<entity name="FemaleAccount" representedClassName="CoreStoreDemo.FemaleAccount" parentEntity="UserAccount" syncable="YES"/>
|
||||
<entity name="MaleAccount" representedClassName="CoreStoreDemo.MaleAccount" parentEntity="UserAccount" syncable="YES"/>
|
||||
<entity name="UserAccount" representedClassName="CoreStoreDemo.UserAccount" isAbstract="YES" syncable="YES">
|
||||
<attribute name="accountType" optional="YES" attributeType="String" syncable="YES"/>
|
||||
<attribute name="friends" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
|
||||
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
|
||||
</entity>
|
||||
<configuration name="FemaleAccounts">
|
||||
<memberEntity name="FemaleAccount"/>
|
||||
<memberEntity name="UserAccount"/>
|
||||
</configuration>
|
||||
<configuration name="MaleAccounts">
|
||||
<memberEntity name="MaleAccount"/>
|
||||
<memberEntity name="UserAccount"/>
|
||||
</configuration>
|
||||
<elements>
|
||||
<element name="UserAccount" positionX="-63" positionY="-18" width="128" height="90"/>
|
||||
<element name="MaleAccount" positionX="-54" positionY="18" width="128" height="45"/>
|
||||
<element name="FemaleAccount" positionX="-36" positionY="27" width="128" height="45"/>
|
||||
</elements>
|
||||
</model>
|
||||
@@ -18,7 +18,7 @@ private struct Static {
|
||||
|
||||
static let placeController: ManagedObjectController<Place> = {
|
||||
|
||||
CoreStore.addSQLiteStore(
|
||||
CoreStore.addSQLiteStoreAndWait(
|
||||
"PlaceDemo.sqlite",
|
||||
configuration: "TransactionsDemo",
|
||||
resetStoreOnMigrationFailure: true
|
||||
|
||||
Reference in New Issue
Block a user