This repository has been archived by the owner on Feb 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
205 additions
and
128 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,39 @@ | ||
// | ||
// AppExtensionDataContext.swift | ||
// | ||
// Created by Vanderlei Martinelli on 2015-05-09. | ||
// | ||
|
||
import Foundation | ||
import AlecrimCoreData | ||
|
||
class AppExtensionDataContext: AlecrimCoreData.Context { | ||
|
||
var people: Table<PersonEntity> { return Table<PersonEntity>(context: self) } | ||
var departments: Table<DepartmentEntity> { return Table<DepartmentEntity>(context: self) } | ||
|
||
// MARK - custom init | ||
|
||
convenience init?() { | ||
let contextOptions = ContextOptions(stackType: .SQLite) | ||
|
||
// only needed if entity class names are different from entity names | ||
contextOptions.entityClassNameSuffix = "Entity" | ||
|
||
// needed as your model probably is not in the main bundle | ||
contextOptions.modelBundle = NSBundle(forClass: AppExtensionDataContext.self) | ||
|
||
// set the managed object model name, usually the same name as the main app name | ||
contextOptions.managedObjectModelName = "MyModelName" | ||
|
||
// must be set to not infer from main bundle | ||
contextOptions.persistentStoreRelativePath = "com.company.MyAppName/CoreData" | ||
|
||
// the same identifier used to group your main app and its extensions | ||
contextOptions.applicationGroupIdentifier = "group.com.company.MyAppName" | ||
|
||
// call designated initializer | ||
self.init(contextOptions: contextOptions) | ||
} | ||
|
||
} |
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
Oops, something went wrong.