-
Notifications
You must be signed in to change notification settings - Fork 4
/
Hymn+CoreDataProperties.swift
64 lines (51 loc) · 1.51 KB
/
Hymn+CoreDataProperties.swift
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
56
57
58
59
60
61
62
63
64
//
// Hymn+CoreDataProperties.swift
// iOS
//
// Created by Tinashe on 2021/03/07.
//
//
import Foundation
import CoreData
extension Hymn {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Hymn> {
return NSFetchRequest<Hymn>(entityName: "Hymn")
}
@NSManaged public var book: String?
@NSManaged public var content: String?
@NSManaged public var markdown: String?
@NSManaged public var edited_content: String?
@NSManaged public var id: UUID?
@NSManaged public var number: Int16
@NSManaged public var title: String?
@NSManaged public var titleStr: String?
@NSManaged public var collection: NSSet?
}
// MARK: Generated accessors for collection
extension Hymn {
@objc(addCollectionObject:)
@NSManaged public func addToCollection(_ value: Collection)
@objc(removeCollectionObject:)
@NSManaged public func removeFromCollection(_ value: Collection)
@objc(addCollection:)
@NSManaged public func addToCollection(_ values: NSSet)
@objc(removeCollection:)
@NSManaged public func removeFromCollection(_ values: NSSet)
}
extension Hymn : Identifiable {
var wrappedTitle: String {
title ?? ""
}
var wrappedTitleStr: String {
titleStr ?? wrappedTitle.titleStr
}
var wrappedContent: String {
content ?? (markdown ?? "")
}
var collections: [Collection] {
let set = collection as? Set<Collection> ?? []
return set.sorted {
$0.wrappedTitle < $1.wrappedTitle
}
}
}