質問編集履歴

1

項目の整理 文言追加

2019/02/25 03:07

投稿

shsw228
shsw228

スコア20

test CHANGED
File without changes
test CHANGED
@@ -1,26 +1,24 @@
1
- 現在APIを叩いて返ってきた値を使ってUITableViewで表示するアプリを書いています。返り値は以下のようになっています。
1
+ 現在APIを叩いて返ってきた値を使ってUITableViewで表示するアプリを書いています。Alamofireのresponse.result.valueで取得できる値は以下のようになっています。
2
2
 
3
3
 
4
4
 
5
5
  ```json
6
6
 
7
- [{
7
+ [{"created_at" : "aaa"
8
8
 
9
- "項目1" : "aaa"
9
+ "author" : "bbb"
10
10
 
11
- "項目2" : "bbb"
12
-
13
- "項目3" : "ccc"
11
+ "score" : "ccc"
14
12
 
15
13
 
16
14
 
17
15
  },{
18
16
 
19
- "項目1" : "aaa"
17
+ "created_at" : "aaa"
20
18
 
21
- "項目2" : "bbb"
19
+ "author" : "bbb"
22
20
 
23
- "項目3" : "ccc"
21
+ "score" : "ccc"
24
22
 
25
23
  }]
26
24
 
@@ -32,27 +30,17 @@
32
30
 
33
31
  ```swift
34
32
 
35
- func getCellData(json:JSON){
33
+ func getCellData(json:JSON){
36
34
 
37
35
  if let postedDateUnixTime = json[0]["created_at"].string {
38
-
39
- postedDataModel.postedDate = postedDateUnixTime
40
36
 
41
37
  postedDataModel.postedBy = json[0]["author"].stringValue
42
38
 
43
39
  postedDataModel.scoreNumber = json[0]["score"].stringValue
44
40
 
45
- postedDataModel.sourceNumber = json[0]["source"].stringValue
46
-
47
- postedDataModel.tags = json[0]["tags"].stringValue
48
-
49
- postedDataModel.rate = json[0]["rating"].stringValue
50
-
51
- postedDataModel.rateIconName = postedDataModel.updateRateIcon(rate: postedDataModel.rate)
52
-
53
41
  print(postedDataModel.postedBy)
54
42
 
55
- }
43
+ }
56
44
 
57
45
  else{
58
46
 
@@ -60,9 +48,9 @@
60
48
 
61
49
  }
62
50
 
63
- }
51
+ }
64
52
 
65
- }
53
+
66
54
 
67
55
  ```
68
56