From 4ce3f96dae39e2989862c5073b6cbceeab97dab4 Mon Sep 17 00:00:00 2001 From: CMK Date: Sat, 6 Mar 2021 13:04:30 +0800 Subject: [PATCH] chore: use setPrimitiveValue --- CoreDataStack/Entity/Application.swift | 2 +- CoreDataStack/Entity/Attachment.swift | 2 +- CoreDataStack/Entity/Emoji.swift | 2 +- CoreDataStack/Entity/History.swift | 2 +- .../Entity/MastodonAuthentication.swift | 8 +++--- CoreDataStack/Entity/Mention.swift | 3 ++- CoreDataStack/Entity/Poll.swift | 2 +- CoreDataStack/Entity/PollOption.swift | 2 +- CoreDataStack/Entity/Tag.swift | 2 +- .../xcschemes/xcschememanagement.plist | 27 +++---------------- 10 files changed, 16 insertions(+), 36 deletions(-) diff --git a/CoreDataStack/Entity/Application.swift b/CoreDataStack/Entity/Application.swift index cfbf48f7e..c9aa22833 100644 --- a/CoreDataStack/Entity/Application.swift +++ b/CoreDataStack/Entity/Application.swift @@ -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 diff --git a/CoreDataStack/Entity/Attachment.swift b/CoreDataStack/Entity/Attachment.swift index f3071872f..e580014c1 100644 --- a/CoreDataStack/Entity/Attachment.swift +++ b/CoreDataStack/Entity/Attachment.swift @@ -36,7 +36,7 @@ public extension Attachment { override func awakeFromInsert() { super.awakeFromInsert() - createdAt = Date() + setPrimitiveValue(Date(), forKey: #keyPath(Attachment.createdAt)) } @discardableResult diff --git a/CoreDataStack/Entity/Emoji.swift b/CoreDataStack/Entity/Emoji.swift index f43dcbf4a..933baab96 100644 --- a/CoreDataStack/Entity/Emoji.swift +++ b/CoreDataStack/Entity/Emoji.swift @@ -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 diff --git a/CoreDataStack/Entity/History.swift b/CoreDataStack/Entity/History.swift index 664933687..552e2a406 100644 --- a/CoreDataStack/Entity/History.swift +++ b/CoreDataStack/Entity/History.swift @@ -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 diff --git a/CoreDataStack/Entity/MastodonAuthentication.swift b/CoreDataStack/Entity/MastodonAuthentication.swift index e58c2e877..0ee0e343b 100644 --- a/CoreDataStack/Entity/MastodonAuthentication.swift +++ b/CoreDataStack/Entity/MastodonAuthentication.swift @@ -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 diff --git a/CoreDataStack/Entity/Mention.swift b/CoreDataStack/Entity/Mention.swift index caec10d32..e659cf891 100644 --- a/CoreDataStack/Entity/Mention.swift +++ b/CoreDataStack/Entity/Mention.swift @@ -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 diff --git a/CoreDataStack/Entity/Poll.swift b/CoreDataStack/Entity/Poll.swift index cc5e7bbcb..356f2fc2e 100644 --- a/CoreDataStack/Entity/Poll.swift +++ b/CoreDataStack/Entity/Poll.swift @@ -35,7 +35,7 @@ extension Poll { public override func awakeFromInsert() { super.awakeFromInsert() - createdAt = Date() + setPrimitiveValue(Date(), forKey: #keyPath(Poll.createdAt)) } @discardableResult diff --git a/CoreDataStack/Entity/PollOption.swift b/CoreDataStack/Entity/PollOption.swift index f9a3ce953..8917a7533 100644 --- a/CoreDataStack/Entity/PollOption.swift +++ b/CoreDataStack/Entity/PollOption.swift @@ -27,7 +27,7 @@ extension PollOption { public override func awakeFromInsert() { super.awakeFromInsert() - createdAt = Date() + setPrimitiveValue(Date(), forKey: #keyPath(PollOption.createdAt)) } @discardableResult diff --git a/CoreDataStack/Entity/Tag.swift b/CoreDataStack/Entity/Tag.swift index 3f5d2bcac..d817c774b 100644 --- a/CoreDataStack/Entity/Tag.swift +++ b/CoreDataStack/Entity/Tag.swift @@ -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 diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 7f54faa33..747fe7df0 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ CoreDataStack.xcscheme_^#shared#^_ orderHint - 13 + 7 Mastodon - RTL.xcscheme_^#shared#^_ @@ -22,31 +22,10 @@ Mastodon.xcscheme_^#shared#^_ orderHint - 1 + 12 SuppressBuildableAutocreation - - DB427DD125BAA00100D1B89D - - primary - - - DB427DE725BAA00100D1B89D - - primary - - - DB427DF225BAA00100D1B89D - - primary - - - DB89B9F525C10FD0008580ED - - primary - - - +