iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 3
0
Software Development

利用Swift 4開發iOS App,Daily Work List系列 第 3

Day 3. Data Storage & Create Project with Cocoapods

今天先初步把之後的資料結構規劃出來,預期使用SQLite,搭配plist去呈現(之後會特別有一篇分享議題來討論關於iOS常用的儲存方式)

資料結構如下:
https://ithelp.ithome.com.tw/upload/images/20181003/20111916rdZWxevv1f.png

再來,我要利用xcode搭配Cocoapods來建立專案
會利用圖片盡量一步步的呈現

有關Cocoapods 的介紹與安裝可以參考下列資料來源:

SQLite中Cocoapods的參考:

首先先於xcode建立專案
https://ithelp.ithome.com.tw/upload/images/20181003/20111916ncpziIidhN.png
選擇Tabbed App,他會先幫忙建出相關的設定,挺方便的
(立刻就推翻昨天的prototype....沒關係,有發現更好的方式,當然是隨時調整!)
https://ithelp.ithome.com.tw/upload/images/20181003/201119160trNdGdldy.png
鍵入相關資料名稱,選擇語言為Swift
因為沒有要寫Test檔,所以下面兩個不用勾選
https://ithelp.ithome.com.tw/upload/images/20181003/20111916e63r9qrctx.png
完成後會看到xcode的畫面呈現這樣的內容
已經先刻畫好兩個ViewController了
可以直接run起來看看喔(這邊就不附圖了,就是預設的,有興趣的大大可以自己試試看喔)
https://ithelp.ithome.com.tw/upload/images/20181003/20111916LfSs7B11hH.png
接著要來利用cocoapods安裝sqlite
開啟Terminal進入到專案資料夾下
打下指令pod init
之後專案folder下會多出一個podfile的文件
https://ithelp.ithome.com.tw/upload/images/20181003/20111916LFrhJm5ju0.png
文件內容如下,需要編輯他,加入要用的第三方套件
https://ithelp.ithome.com.tw/upload/images/20181003/20111916NsNZuyhP5j.png
存檔後回到Terminal,執行pod install(會花點時間執行)
https://ithelp.ithome.com.tw/upload/images/20181003/20111916FKwcvA4FSP.png
執行完成後會發現folder下方多了些檔案
https://ithelp.ithome.com.tw/upload/images/20181003/20111916pE9UfAxu0b.png
這之後開啟專案,都要用xcworkspace的檔案喔
再次開啟專案,會發現右側的選單已經改變,安裝好SQLite的套件了
https://ithelp.ithome.com.tw/upload/images/20181003/20111916FArbEFlo4N.png

以上就是今天的內容囉
明天會把LaunchPage完成!


上一篇
Day 2. Prototype
下一篇
Day 4. Develop Launch Page
系列文
利用Swift 4開發iOS App,Daily Work List31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言