質問編集履歴

1

付け足した部分を追加しました。

2020/03/31 02:37

投稿

Kaguya_4869
Kaguya_4869

スコア117

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  ```ここに言語を入力
18
18
 
19
- @IBAction func redColor(_ sender: UIButton) {
19
+ @IBAction func redColor(_ sender: UIButton) {
20
20
 
21
21
  typingColor = UIColor.red
22
22
 
@@ -31,6 +31,10 @@
31
31
  eventText.attributedText = string
32
32
 
33
33
  eventText.selectedRange = range
34
+
35
+ NSData as Data = try! NSKeyedArchiver.archivedData(withRootObject: typingColor, requiringSecureCoding: true)
36
+
37
+ UserDefaults.standard.set(typingColor, forKey: "red")
34
38
 
35
39
  }
36
40
 
@@ -50,6 +54,10 @@
50
54
 
51
55
  eventText.selectedRange = range
52
56
 
57
+ NSData as Data = try! NSKeyedArchiver.archivedData(withRootObject: typingColor, requiringSecureCoding: true)
58
+
59
+ UserDefaults.standard.set(typingColor, forKey: "blue")
60
+
53
61
  }
54
62
 
55
63
  ```