Swift GMの発表を機にiOS アプリ開発を始めようと思い立ち,とりあえずRSS viewer とかでありがちな 「API をたたく-> 一覧表示する -> 選択したものの詳細を表示」 を達成できるようチャレンジしました。
https://github.com/brownbro/TableFromJson
HTTP request はAlamofire(https://github.com/Alamofire/Alamofire) を, json のパースはSwiftyJson(https://github.com/SwiftyJSON/SwiftyJSON) を使わせていただきました。 どちらもREADME が充実していて助かりましたが,
Alamofire.request(.GET, "http://brownbro-json-api-test.herokuapp.com/api/items")
.responseJSON {(request, response, JSONresponse, error) in
let result = JSON(object: JSONresponse!)
for (var i = 0; i < result.arrayValue?.count; i++) {
のresult.arrayValue?.count はこれで正しいのか分からないです。
Optional もXcode に言われるがままに直してます。
勉強しつつ,試行錯誤しつつ,手を加えていきたいと思います。