-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlogEntry+CoreDataProperties.swift
More file actions
44 lines (36 loc) · 1.01 KB
/
BlogEntry+CoreDataProperties.swift
File metadata and controls
44 lines (36 loc) · 1.01 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
//
// BlogEntry+CoreDataProperties.swift
// BlogApp
//
// Created by 周元博 on 10/19/21.
//
//
import Foundation
import CoreData
extension BlogEntry {
@nonobjc public class func fetchRequest() -> NSFetchRequest<BlogEntry> {
return NSFetchRequest<BlogEntry>(entityName: "BlogEntry")
}
@NSManaged public var content: String?
@NSManaged public var date: Date?
}
extension BlogEntry : Identifiable {
func setMonth() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MMM"
if let dateToBeModified = date {
let month = dateFormatter.string(from: dateToBeModified)
return month.uppercased()
}
return ""
}
func setDay() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "d"
if let dateToBeModified = date {
let day = dateFormatter.string(from: dateToBeModified)
return day.uppercased()
}
return ""
}
}