Skip to content

Commit 132465f

Browse files
committed
Assign default value on insert, remove optionals
1 parent 41003b9 commit 132465f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

WordPress/Classes/Models/BloggingPrompt+CoreDataClass.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public class BloggingPrompt: NSManagedObject {
1212
return NSEntityDescription.insertNewObject(forEntityName: Self.classNameWithoutNamespaces(), into: context) as? BloggingPrompt
1313
}
1414

15+
public override func awakeFromInsert() {
16+
self.date = .init(timeIntervalSince1970: 0)
17+
self.displayAvatarURLs = []
18+
}
19+
1520
/// Convenience method to map properties from `RemoteBloggingPrompt`.
1621
///
1722
/// - Parameters:

WordPress/Classes/Models/BloggingPrompt+CoreDataProperties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ extension BloggingPrompt {
3030
@NSManaged public var answerCount: Int32
3131

3232
/// Contains avatar URLs of some users that have answered the prompt.
33-
@NSManaged public var displayAvatarURLs: [URL]?
33+
@NSManaged public var displayAvatarURLs: [URL]
3434
}

0 commit comments

Comments
 (0)