王恆
王恆
Sep 9, 2018 · 2 min read

Swift: Weather app

Weather API : https://openweathermap.org/

嘗試讓串weather API , 希望能看見溫度掉下來。

先讀取WeatherAPI看看需要什麼參數,看取幾個city。

呼叫WeatherAPI後,取得JSON格式的檔案,依據JSON Data的檔案架構,去建立Model,依照Model中的結構去解析,解析完的Data回傳給Model,並reload Table讓Table重載用來顯示的資料,cell讀取Model Data 並顯示。

取Model 城市、溫度、風速來顯示畫面,可以在cell用func 也可以用 didSet 去顯示。

執行專案前,先思考流程,才不會多此一舉。

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade