回答編集履歴

2

修正

2016/07/17 12:45

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -1,4 +1,4 @@
1
- 確かめることができませんが、以下のようするとどうでょうか?
1
+ 以下のデータて`Optional<Optional<String>>`を作成てアンラップしてみました、参考にしてみてください。
2
2
 
3
3
 
4
4
 

1

修正

2016/07/17 12:45

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -2,8 +2,34 @@
2
2
 
3
3
 
4
4
 
5
- ```swiwf
5
+ ```swift
6
+
7
+ // 設定されている値の例
8
+
9
+ let article: [String: String?] = ["avatar": "value"]
10
+
11
+ ```
12
+
13
+
14
+
15
+ ```swift
16
+
17
+ // Forced Unwrappingで取り出す
6
18
 
7
19
  vc.text = article["avatar"]!!
8
20
 
9
21
  ```
22
+
23
+
24
+
25
+ ```swift
26
+
27
+ // Optional Bindingで取り出す
28
+
29
+ if let optionalVal = article["avatar"], let val = optionalVal {
30
+
31
+ vc.text = val
32
+
33
+ }
34
+
35
+ ```