UserDefaultsに保存するため以下の様にData型にして読み込む際にUIcolorに戻したいです。
swift
1let c:Data = NSKeyedArchiver.archivedData(withRootObject: current_work_color)//current_work_colorはUIcolorです 2 3/******** 4Data型で宣言した構造体の要素にcを格納 5以下で呼び出す 6*******/ 7 8if let c = NSKeyedUnarchiver.unarchiveObject(with: t.my_color) as? UIColor { 9 10 print(type(of: c)) 11
これでプリントされるのはUIDeviceRGBColorです。これは何故でしょうか?UIcolorとして使いたいのですが。。。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/12 06:48