-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests and automatic context management (#5)
- Unit tests - Added optional automatic context management - Simplified `destroyAll()` method
- Loading branch information
Showing
49 changed files
with
1,165 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Foundation | ||
import UIKit | ||
import CoreDataPlus | ||
import CoreData | ||
|
||
class AppDelegate: NSObject, UIApplicationDelegate { | ||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | ||
let viewContext = PersistenceController.shared.container.viewContext | ||
|
||
let backgroundContext = PersistenceController.shared.container.newBackgroundContext() | ||
backgroundContext.automaticallyMergesChangesFromParent = true | ||
backgroundContext.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy | ||
|
||
CoreDataPlus.setup( viewContext: viewContext, | ||
backgroundContext: backgroundContext, | ||
logHandler: { message in print("🌎🌧 log: \(message)") } | ||
) | ||
|
||
return true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Example App/Example App/Documentation.docc/Documentation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# ```` | ||
|
||
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@--> | ||
|
||
## Overview | ||
|
||
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@--> | ||
|
||
## Topics | ||
|
||
### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@--> | ||
|
||
- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@--> |
13 changes: 11 additions & 2 deletions
13
Example App/Example App/Example_App.xcdatamodeld/Example_App.xcdatamodel/contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21279" systemVersion="21G72" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> | ||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="21G320" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> | ||
<entity name="Author" representedClassName="Author" syncable="YES" codeGenerationType="class"> | ||
<attribute name="id" optional="YES" attributeType="String"/> | ||
<attribute name="name" attributeType="String" defaultValueString=""/> | ||
<relationship name="books" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Book" inverseName="authors" inverseEntity="Book"/> | ||
<uniquenessConstraints> | ||
<uniquenessConstraint> | ||
<constraint value="name"/> | ||
</uniquenessConstraint> | ||
</uniquenessConstraints> | ||
</entity> | ||
<entity name="Book" representedClassName="Book" syncable="YES" codeGenerationType="class"> | ||
<attribute name="id" attributeType="String"/> | ||
<attribute name="title" attributeType="String" defaultValueString=""/> | ||
<relationship name="authors" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Author" inverseName="books" inverseEntity="Author"/> | ||
<uniquenessConstraints> | ||
<uniquenessConstraint> | ||
<constraint value="id"/> | ||
</uniquenessConstraint> | ||
</uniquenessConstraints> | ||
</entity> | ||
</model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?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/> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source "https://rubygems.org" | ||
|
||
gem "rspec", "~> 3.1" | ||
gem "rake" | ||
gem 'tty-prompt' | ||
gem 'tty-spinner' |
Oops, something went wrong.