forked from jessesquires/JSQCoreDataKit
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUtils.swift
More file actions
55 lines (45 loc) · 1.48 KB
/
Copy pathUtils.swift
File metadata and controls
55 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://www.jessesquires.com/JSQCoreDataKit
//
//
// GitHub
// https://github.com/jessesquires/JSQCoreDataKit
//
//
// License
// Copyright © 2015 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
import CoreData
import Foundation
/// Describes a child managed object context.
public typealias ChildContext = NSManagedObjectContext
/// Describes the initialization options for a persistent store.
public typealias PersistentStoreOptions = [NSObject : AnyObject]
/// Describes default persistent store options.
public let defaultStoreOptions: PersistentStoreOptions = [
NSMigratePersistentStoresAutomaticallyOption as NSObject: true as AnyObject,
NSInferMappingModelAutomaticallyOption as NSObject: true as AnyObject
]
// MARK: Internal
public func defaultDirectoryURL() -> URL {
do {
#if os(tvOS)
let searchPathDirectory = FileManager.SearchPathDirectory.cachesDirectory
#else
let searchPathDirectory = FileManager.SearchPathDirectory.documentDirectory
#endif
return try FileManager.default.url(for: searchPathDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: true)
}
catch {
fatalError("*** Error finding default directory: \(error)")
}
}