質問編集履歴

4

質問修正

2019/09/02 01:14

投稿

mita0
mita0

スコア40

test CHANGED
File without changes
test CHANGED
@@ -22,9 +22,11 @@
22
22
 
23
23
 
24
24
 
25
-
25
+ Googleと検索した際にforの中で「items」をループで取り出しています。
26
+
26
-
27
+ 「hosts」「googletest」など順にtableに出力されます。
28
+
27
-
29
+ tableで「hosts」をタップした時に「hosts内の情報」、「googletest」をタップした時に「googeltest」内の情報」を順番に出したいです。
28
30
 
29
31
 
30
32
 
@@ -34,6 +36,76 @@
34
36
 
35
37
  (配列の中に連想配列があります)
36
38
 
39
+ 下記、JSON + searchBar.text!からの値になります。
40
+
41
+
42
+
43
+
44
+
45
+ "total_count": 553223,
46
+
47
+ "incomplete_results": false,
48
+
49
+ "items": [
50
+
51
+ {
52
+
53
+ "id": 21481439,
54
+
55
+ "node_id": "MDEwOlJlcG9zaXRvcnkyMTQ4MTQzOQ==",
56
+
57
+ "name": "hosts",
58
+
59
+ "full_name": "kelthuzadx/hosts",
60
+
61
+ "private": false,
62
+
63
+ "owner": {
64
+
65
+ "login": "kelthuzadx",
66
+
67
+ "id": 5010047,
68
+
69
+ "node_id": "MDQ6VXNlcjUwMTAwNDc=",
70
+
71
+ "avatar_url": "https://avatars0.githubusercontent.com/u/5010047?v=4",
72
+
73
+ "gravatar_id": "",
74
+
75
+ "url": "https://api.github.com/users/kelthuzadx",
76
+
77
+ "html_url": "https://github.com/kelthuzadx",
78
+
79
+ "followers_url": "https://api.github.com/users/kelthuzadx/followers",
80
+
81
+ "following_url": "https://api.github.com/users/kelthuzadx/following{/other_user}",
82
+
83
+ "gists_url": "https://api.github.com/users/kelthuzadx/gists{/gist_id}",
84
+
85
+ "starred_url": "https://api.github.com/users/kelthuzadx/starred{/owner}{/repo}",
86
+
87
+ "subscriptions_url": "https://api.github.com/users/kelthuzadx/subscriptions",
88
+
89
+ "organizations_url": "https://api.github.com/users/kelthuzadx/orgs",
90
+
91
+ "repos_url": "https://api.github.com/users/kelthuzadx/repos",
92
+
93
+ "events_url": "https://api.github.com/users/kelthuzadx/events{/privacy}",
94
+
95
+ "received_events_url": "https://api.github.com/users/kelthuzadx/received_events",
96
+
97
+ "type": "User",
98
+
99
+ "site_admin": false
100
+
101
+ },
102
+
103
+ "html_url": "https://github.com/kelthuzadx/hosts",
104
+
105
+ "description": ":statue_of_liberty:最新可用的google hosts文件。国内镜像:",
106
+
107
+
108
+
37
109
 
38
110
 
39
111
 

3

2019/09/02 01:14

投稿

mita0
mita0

スコア40

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  それにともなってやりたいことは以下の通りです。
16
16
 
17
- ①メンバ変数に定義
17
+ ①メンバ変数に定義(配列のデータを配列に格納したい)
18
18
 
19
19
  ②JSONデータの受け渡し(tableviewのTapした箇所)
20
20
 
@@ -22,6 +22,14 @@
22
22
 
23
23
 
24
24
 
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
25
33
  ※ JSONデータ https://api.github.com/search/repositories?q=%20Google
26
34
 
27
35
  (配列の中に連想配列があります)

2

p

2019/09/02 01:11

投稿

mita0
mita0

スコア40

test CHANGED
File without changes
test CHANGED
@@ -269,3 +269,123 @@
269
269
 
270
270
 
271
271
  ```
272
+
273
+ ```
274
+
275
+
276
+
277
+ import UIKit
278
+
279
+
280
+
281
+ class ThirdViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
282
+
283
+
284
+
285
+ var hosts: [String] = []
286
+
287
+
288
+
289
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
290
+
291
+ return self.hosts.count
292
+
293
+ }
294
+
295
+
296
+
297
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
298
+
299
+ let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
300
+
301
+ cell.textLabel!.text = hosts[indexPath.row]
302
+
303
+ return cell
304
+
305
+ }
306
+
307
+
308
+
309
+
310
+
311
+ override func viewDidLoad() {
312
+
313
+ super.viewDidLoad()
314
+
315
+
316
+
317
+ }
318
+
319
+ override func didReceiveMemoryWarning() {
320
+
321
+ super.didReceiveMemoryWarning()
322
+
323
+ }
324
+
325
+
326
+
327
+ func back() {
328
+
329
+ self.navigationController?.popToRootViewController(animated: true)
330
+
331
+
332
+
333
+ }
334
+
335
+
336
+
337
+ @IBAction func byPerformSegue(_ sender: Any) {
338
+
339
+ self.performSegue(withIdentifier: "toSegueViewController", sender: nil)
340
+
341
+
342
+
343
+ }
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+ //self.navigationController?.popViewController(animated: true)
362
+
363
+
364
+
365
+ /*
366
+
367
+ // MARK: - Navigation
368
+
369
+
370
+
371
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
372
+
373
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
374
+
375
+ // Get the new view controller using segue.destination.
376
+
377
+ // Pass the selected object to the new view controller.
378
+
379
+ }
380
+
381
+ */
382
+
383
+
384
+
385
+ }
386
+
387
+
388
+
389
+
390
+
391
+ ```

1

2019/08/30 06:44

投稿

mita0
mita0

スコア40

test CHANGED
File without changes
test CHANGED
@@ -46,19 +46,7 @@
46
46
 
47
47
  ```ここに言語を入力### 該当のソースコード
48
48
 
49
- //
49
+
50
-
51
- // ViewController.swift
52
-
53
- // test0826.1
54
-
55
- //
56
-
57
- // Created by Kamitani on 2019/08/26.
58
-
59
- // Copyright © 2019 Kamitani. All rights reserved.
60
-
61
- //
62
50
 
63
51
 
64
52