chore: use setPrimitiveValue

This commit is contained in:
CMK 2021-03-06 13:04:30 +08:00
parent 07d3c3cbff
commit 4ce3f96dae
10 changed files with 16 additions and 36 deletions

View File

@ -24,7 +24,7 @@ public final class Application: NSManagedObject {
public extension Application {
override func awakeFromInsert() {
super.awakeFromInsert()
identifier = UUID()
setPrimitiveValue(UUID(), forKey: #keyPath(Application.identifier))
}
@discardableResult

View File

@ -36,7 +36,7 @@ public extension Attachment {
override func awakeFromInsert() {
super.awakeFromInsert()
createdAt = Date()
setPrimitiveValue(Date(), forKey: #keyPath(Attachment.createdAt))
}
@discardableResult

View File

@ -26,7 +26,7 @@ public final class Emoji: NSManagedObject {
public extension Emoji {
override func awakeFromInsert() {
super.awakeFromInsert()
identifier = UUID()
setPrimitiveValue(UUID(), forKey: #keyPath(Emoji.identifier))
}
@discardableResult

View File

@ -24,7 +24,7 @@ public final class History: NSManagedObject {
public extension History {
override func awakeFromInsert() {
super.awakeFromInsert()
identifier = UUID()
setPrimitiveValue(UUID(), forKey: #keyPath(History.identifier))
}
@discardableResult

View File

@ -36,12 +36,12 @@ extension MastodonAuthentication {
public override func awakeFromInsert() {
super.awakeFromInsert()
identifier = UUID()
setPrimitiveValue(UUID(), forKey: #keyPath(MastodonAuthentication.identifier))
let now = Date()
createdAt = now
updatedAt = now
activedAt = now
setPrimitiveValue(now, forKey: #keyPath(MastodonAuthentication.createdAt))
setPrimitiveValue(now, forKey: #keyPath(MastodonAuthentication.updatedAt))
setPrimitiveValue(now, forKey: #keyPath(MastodonAuthentication.activedAt))
}
@discardableResult

View File

@ -25,7 +25,8 @@ public final class Mention: NSManagedObject {
public extension Mention {
override func awakeFromInsert() {
super.awakeFromInsert()
identifier = UUID()
setPrimitiveValue(UUID(), forKey: #keyPath(Mention.identifier))
}
@discardableResult

View File

@ -35,7 +35,7 @@ extension Poll {
public override func awakeFromInsert() {
super.awakeFromInsert()
createdAt = Date()
setPrimitiveValue(Date(), forKey: #keyPath(Poll.createdAt))
}
@discardableResult

View File

@ -27,7 +27,7 @@ extension PollOption {
public override func awakeFromInsert() {
super.awakeFromInsert()
createdAt = Date()
setPrimitiveValue(Date(), forKey: #keyPath(PollOption.createdAt))
}
@discardableResult

View File

@ -26,7 +26,7 @@ public final class Tag: NSManagedObject {
extension Tag {
public override func awakeFromInsert() {
super.awakeFromInsert()
identifier = UUID()
setPrimitiveValue(UUID(), forKey: #keyPath(Tag.identifier))
}
@discardableResult

View File

@ -7,7 +7,7 @@
<key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>13</integer>
<integer>7</integer>
</dict>
<key>Mastodon - RTL.xcscheme_^#shared#^_</key>
<dict>
@ -22,31 +22,10 @@
<key>Mastodon.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>12</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>DB427DD125BAA00100D1B89D</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>DB427DE725BAA00100D1B89D</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>DB427DF225BAA00100D1B89D</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>DB89B9F525C10FD0008580ED</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
<dict/>
</dict>
</plist>