回答編集履歴
3
説明追加
test
CHANGED
File without changes
|
2
説明追加
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
実装例
|
7
|
+
実装例(darkモードの場合は単純に通常のlightColorの反対色を返すだけ)
|
8
8
|
|
9
9
|
```
|
10
10
|
|
1
実装例の追加
test
CHANGED
@@ -4,6 +4,32 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
実装例
|
8
|
+
|
9
|
+
```
|
10
|
+
|
11
|
+
UIColor { (traitCollection: UITraitCollection) -> UIColor in
|
12
|
+
|
13
|
+
switch traitCollection.userInterfaceStyle {
|
14
|
+
|
15
|
+
case
|
16
|
+
|
17
|
+
.unspecified,
|
18
|
+
|
19
|
+
.light: return lightColor
|
20
|
+
|
21
|
+
case .dark: return lightColor.inverted
|
22
|
+
|
23
|
+
@unknown default:
|
24
|
+
|
25
|
+
return lightColor
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
|
7
33
|
参考程度に
|
8
34
|
|
9
35
|
https://qiita.com/tamappe/items/5a6031d8b8d39f1e5b4e
|