2 // BookmarkDataStore.swift
5 // Created by Hori,Masaki on 2017/01/06.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
11 extension CoreDataConfiguration {
12 static let bookmark = CoreDataConfiguration("Bookmark")
14 extension CoreDataCore {
15 static let bookmark = CoreDataCore(.bookmark)
18 class BookmarkDataStore: CoreDataAccessor, CoreDataManager {
19 static var `default` = BookmarkDataStore(type: .reader)
20 class func oneTimeEditor() -> BookmarkDataStore {
21 return BookmarkDataStore(type: .editor)
24 required init(type: CoreDataManagerType) {
25 context = (type == .reader ? core.parentContext : core.editorContext())
31 let core = CoreDataCore.bookmark
32 let context: NSManagedObjectContext
35 extension BookmarkDataStore {
36 func createBookmark() -> Bookmark? {
37 return insertNewObject(for: Bookmark.entity)