利用Playground學習Swift程式語言
Use playgrounds to learn and explore Swift programming language (Learn Swift Programming Language)
Playground一個互動式的即時顯示程式執行結果的環境,是一種新的文件型態,讓使用者可以一邊編寫程式並即時地檢閱效果,實現「所見即所寫」的功能。Swift可以包含多種格式如粗體、斜體、條列甚至是嵌入的圖片與連結的本文標註。這些特色提供了非常有利於學習Swift程式語言與程式設計的方式。讀者可以輕鬆地瞭解一段教學內容後,直接在相同的地方練習、編寫、實驗與驗證學習成果,也能同時將學習的心得加入到Playground的頁面中,作為未來複習時的一個參考。
本專案主要為學習Swift程式語言時,邊讀邊練習而產生的文件,程式碼中大部分保留Apple Inc.提供的原始範例,少部分會造成playground無法順利運作的錯誤(注: 書籍中需要有一些產生錯誤的範例來讓讀者瞭解要闡述的內容)則修改或注解化,使其成為不影響運作的部分。
本專案分為五個Playground檔案,分別為:
- Swift Playground - 使用playgrounds學習Swift程式語言
取材自Apple Inc的The Swift Programming Language 2.2版pre-release的iBook內容,程式碼亦是源於該書籍。透過來自原廠的教材內容,改以Playground呈現,提供讀者以原汁原味的方式快速並與之互動地學習。
SWIFT 2.2.playground : Use an interactive Swift coding environment without creating a project to learn Swift.
- The Swift Programming Language來源: https://developer.apple.com/swift/
- Swift Coding Practice - 以playgroung練習與實作程式設計
取材自陳鍾誠教授編撰的教材,透過部分教材內容將之改以Swift語言並以Playground互動式文件呈現,提供讀者得以練習基本的程式設計包含基礎、陣列、矩陣、字串操作、回呼函式、遞迴與一些演算法。
Swift Coding Practice.playground : Basic, Array, Matrix, String, Callback, Recursive & Algorithm.
- 陳鍾誠教授編撰的教材來源: http://ccc.nqu.edu.tw/wd.html#book:home
- Swift Algorithm Practice - 以playgroung練習與實作程式設計
取材自演算法筆記與Swift Algorithm Club,透過部分教材內容將之改以Swift語言並以Playground互動式文件呈現,提供讀者得以學習資料結構、演算法、演算法設計與分析等課題。
swift-algorithm-Chinese.playground : Algorithm Intruduction, Data, Algorithm Design, Algorithm Analysis, Graph Theory, Combinatorial Optimization & Numerical Method...
- General Purpose APIs - 方便以playgroung學習Swift程式設計的API
General Purpose APIs using in Swift playgrounds for learning and experimenting Swift programming language.
透過建立部分資料結構,並透過可視化的方式來增進利用playgroung學習Swift程式設計的效率。
內容涵蓋:String, Complex, Vector, Array2D, Matrix
Additional Topics
- The Traveling Salesman with Simulated Annealing
The Traveling Salesman with Simulated Annealing.playground : demonstrates solving the shortest path of travel itinerary by using Simulated Annealing method.
*************************************
本專案中之文件取材自以下資料來源
*************************************