Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Start using Swift.
Search
DAloG
January 14, 2016
Programming
1
110
Start using Swift.
DAloG
January 14, 2016
Tweet
Share
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
160
Redux + MQTT
dalog
1
760
От задач к проблемам
dalog
1
230
Unlimited power of Data-Driven UI
dalog
4
610
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.8k
2 years of Redux in iOS. Lessons learned
dalog
0
340
Why unidirectional architecture matter for iOS.
dalog
1
270
Mobile backend without REST
dalog
2
88
Self managed teams 101
dalog
0
130
Other Decks in Programming
See All in Programming
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
4
1.3k
GAEログのコスト削減
mot_techtalk
0
110
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
270
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
110
SwiftUI Viewの責務分離
elmetal
PRO
0
140
Ruby on cygwin 2025-02
fd0
0
140
Writing documentation can be fun with plugin system
okuramasafumi
0
120
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
41
15k
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
550
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
150
チームリードになって変わったこと
isaka1022
0
190
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
360
Featured
See All Featured
Become a Pro
speakerdeck
PRO
26
5.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
366
25k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
It's Worth the Effort
3n
184
28k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
What's in a price? How to price your products and services
michaelherold
244
12k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
630
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Transcript
20.01.2016 Forget Objective-C. Start Swift. for Kharkiv Mobile Devs #15
Alexey Demedetskiy ✤ twitter: @DAlooG ✤ email:
[email protected]
✤ skype:
nobidon
Objective-C ✤ KVO/KVC ✤ UIKit ✤ Monolithic namespace ✤ Partially
defined behavior ✤ CoreData
Swift ✤ Closures ✤ Immutability ✤ Value types ✤ Generics
✤ Optionals
Swift ✤ Protocols ✤ Nested types ✤ Static ✤ Default
values ✤ Operators
How to Swift? ✤ Add Swift to existing project ✤
Start new project
Why? ✤ Strong types —> Less errors ✤ More instruments
—> Cleaner code ✤ Better syntax —> Easy to read and write
Optionals vs ‘nil’
nil ✤ [nil aMessage:@«text»] - ✅ ✤ [list addObject:nil] -
❌
Optional<T> ✤ T! ✤ T? ✤ T
Dirty Types ✤ UIKit ✤ External data (Network etc) ✤
Objective-C
How to clear types? ✤ as? : Any -> T?
✤ as! : Any -> T
None
None
None
WTF Immutability. ✤ Reference and Value types ✤ let -
immutable name ✤ var - mutable name
Struct trickery ✤ How many objects will be created? ✤
How many times `print` will write? ✤ What `t1.b` will print?
Struct trickery ✤ 0. There is no objects. ✤ 1.
✤ 4.
Class trickery ✤ How many objects will be created? ✤
How many times `print` will write? ✤ What `t1.b` will print?
Class trickery ✤ 1 ✤ 1 ✤ -1
let == const?
let == const?
Value types Pros ✤ Immutable. Even with `var` ✤ `init`
from compiler ✤ No inheritance
Properties ✤ no setter / getter methods. ✤ …unless `dynamic`
is specified ✤ `willSet` / `didSet` with references to new/old values ✤ `public private(set) var …` is ok
enum vs NS_ENUM
enum vs NS_ENUM
Shadow types!
None
None
When use enum? ✤ Flags ✤ States ✤ Options ✤
Shadow type
Alamofire vs AFNetworking
Namespaces ✤ Nested types ✤ Frameworks ✤ Targets
Nested types
Nested types
Nested types
Nested types
Nested types
let = vs dispatch_once
Outro ✤ Run away from Obj-C ✤ Build your own
logic modules ✤ Use Value Types ✤ Don’t use generics + inheritance + UIKit