-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update CoreDataStack. initial implementation of main and background c…
…ontext.
- Loading branch information
1 parent
5ee6d6d
commit 28b9e4e
Showing
9 changed files
with
214 additions
and
101 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
38 changes: 38 additions & 0 deletions
38
JSQCoreDataKit/JSQCoreDataKit/CoreDataStackInitializer.swift
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,38 @@ | ||
// | ||
// Created by Jesse Squires | ||
// http://www.jessesquires.com | ||
// | ||
// | ||
// Documentation | ||
// http://www.jessesquires.com/JSQCoreDataKit | ||
// | ||
// | ||
// GitHub | ||
// https://github.com/jessesquires/JSQCoreDataKit | ||
// | ||
// | ||
// License | ||
// Copyright (c) 2015 Jesse Squires | ||
// Released under an MIT license: http://opensource.org/licenses/MIT | ||
// | ||
|
||
import CoreData | ||
import Foundation | ||
|
||
public struct StackInitializer { | ||
|
||
public typealias StackInitHandler = (Void) -> CoreDataStack? | ||
|
||
public typealias StackCompletionHandler = (CoreDataStack?) -> Void | ||
|
||
public static func Create(initialize: StackInitHandler, completion: StackCompletionHandler) { | ||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { | ||
let stack = initialize() | ||
|
||
dispatch_async(dispatch_get_main_queue()) { | ||
completion(stack) | ||
} | ||
} | ||
} | ||
|
||
} |
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.