- Swift Game Development(Third Edition)
- Siddharth Shekar Stephen Haney
- 359字
- 2021-07-16 17:37:40
Why you will love Swift
Swift, as a modern programming language, benefits from the collective experience of the programming community; it combines the best parts of other languages and avoids poor design decisions. Here are a few of my favorite Swift features:
- Interoperability: Swift can plug directly into your existing projects and run side by side with your Objective-C code.
- Strong typing: Swift is a strongly typed language. This means the compiler will catch more bugs at compile time, instead of when your users are playing your game! The compiler will expect your variables to be of a certain type (
int
,string
, and so on) and will throw a compile-time error if you try to assign a value of a different type. While this may seem rigid if you are coming from a weakly typed language, the added structure results in safer, more reliable code. - Smart type inference: To make things easier, type inference will automatically detect the types of your variables and constants based upon their initial value. You do not need to explicitly declare a type for your variables. Swift is smart enough to infer variable types in most expressions.
- Automatic memory management: As the Apple Swift developer guide states, "memory management just works in Swift". Swift uses a method called Automatic Reference Counting (ARC) to manage your game's memory usage. Besides a few edge cases, you can rely on Swift to safely clean up and turn off the lights.
- An even playing field: One of my favorite things about Swift is how quickly the language is gaining mainstream adoption. We are all learning and growing together, and there is a tremendous opportunity to break new ground.
- Open source: From version 2.2 onwards, Apple made Swift open source, curating it through the website www.swift.org, and launched a package manager with Swift 3. This is a welcome change, as it fosters greater community involvement and a larger ecosystem of third-party tools and add-ons. Eventually, we should see Swift migrate to new platforms.
推薦閱讀
- 中國人民大學(xué)復(fù)印報刊資料轉(zhuǎn)載指數(shù)排名研究報告2016
- 文獻(xiàn)保護(hù)中英雙解詞語手冊
- 博物館新視覺:博物館管理叢書
- 李一氓文存(第四卷):古籍整理
- 云環(huán)境下我國綜合數(shù)字檔案館建設(shè)模式研究
- 文獻(xiàn)價值:理論文獻(xiàn)學(xué)的價值論解讀
- 魯迅輯校古籍考
- 圖書館戰(zhàn)略規(guī)劃研究
- 當(dāng)代博物館的新角色與新視野
- 李一氓文存(套裝全五冊)
- 檔案資源社會化:檔案資源結(jié)構(gòu)的歷史性變化
- 基于大數(shù)據(jù)時代的圖書情報管理與服務(wù)研究
- 家庭檔案管理一本通
- 枝葉情:哲學(xué)·文化·教育論
- 2017浙江科技統(tǒng)計(jì)年鑒