- Game Development with Swift
- Stephen Haney
- 310字
- 2021-07-16 13:45:38
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 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 (you will see it referred to as 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.
- 在你身邊為你設(shè)計(jì)Ⅲ:騰訊服務(wù)設(shè)計(jì)思維與實(shí)戰(zhàn)
- Python數(shù)據(jù)分析與挖掘?qū)崙?zhàn)
- Test-Driven Development with Mockito
- MongoDB管理與開發(fā)精要
- Python數(shù)據(jù)分析、挖掘與可視化從入門到精通
- MySQL從入門到精通(第3版)
- 大數(shù)據(jù)導(dǎo)論
- 數(shù)據(jù)庫(kù)開發(fā)實(shí)踐案例
- 數(shù)據(jù)化網(wǎng)站運(yùn)營(yíng)深度剖析
- Lean Mobile App Development
- 大數(shù)據(jù)營(yíng)銷:如何讓營(yíng)銷更具吸引力
- 智能數(shù)據(jù)時(shí)代:企業(yè)大數(shù)據(jù)戰(zhàn)略與實(shí)戰(zhàn)
- Python金融實(shí)戰(zhàn)
- 基于OPAC日志的高校圖書館用戶信息需求與檢索行為研究
- 新基建:數(shù)據(jù)中心創(chuàng)新之路