- 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:
- Beautiful syntax: Swift's syntax is modern and approachable, regardless of your existing programming experience. Apple have balanced syntax with structure to make Swift concise and readable.
- 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.
推薦閱讀
- 中國(guó)人民大學(xué)復(fù)印報(bào)刊資料轉(zhuǎn)載指數(shù)排名研究報(bào)告2016
- 北宋書籍刊刻與古文運(yùn)動(dòng)
- 公共圖書館文獻(xiàn)信息資源政府采購(gòu)
- 國(guó)外圖書館動(dòng)漫資源建設(shè)與服務(wù)
- 人文通識(shí)講演錄:人文教育卷
- 檔案庫(kù)房技術(shù)管理
- 知中16·西南聯(lián)大的遺產(chǎn)
- 珠江論叢(2019年第2輯/總第24輯)
- 大數(shù)據(jù)環(huán)境下高校圖書館知識(shí)服務(wù)模式研究
- 中國(guó)古典文獻(xiàn)學(xué)(東北師范大學(xué)文學(xué)院學(xué)術(shù)史文庫(kù))
- 邂逅法學(xué)圖書館:浙江大學(xué)光華法學(xué)院師生原創(chuàng)文集
- 法學(xué)研究與文獻(xiàn)檢索
- Rust Programming By Example
- 基于價(jià)值全面實(shí)現(xiàn)的檔案信息資源配置
- 高校圖書館創(chuàng)新服務(wù)(谷臻小簡(jiǎn)·AI導(dǎo)讀版)