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
170
Redux + MQTT
dalog
1
760
От задач к проблемам
dalog
1
240
Unlimited power of Data-Driven UI
dalog
4
620
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.9k
2 years of Redux in iOS. Lessons learned
dalog
0
350
Why unidirectional architecture matter for iOS.
dalog
1
280
Mobile backend without REST
dalog
2
92
Self managed teams 101
dalog
0
130
Other Decks in Programming
See All in Programming
By the way Google Cloud Next 2025に行ってみてどうだった
ymd65536
0
110
KANNA Android の技術的課題と取り組み
watabee
0
190
flutter_kaigi_mini_4.pdf
nobu74658
0
140
The Implementations of Advanced LR Parser Algorithm
junk0612
2
1.4k
Orleans + Sekiban + SignalR でリアルタイムWeb作ってみた
tomohisa
0
230
GitHub Copilot for Azureを使い倒したい
ymd65536
1
320
Road to RubyKaigi: Making Tinny Chiptunes with Ruby
makicamel
4
540
2ヶ月で生産性2倍、お買い物アプリ「カウシェ」4チーム同時改善の取り組み
ike002jp
1
110
eBPF超入門「o11yに使える」とは (20250424_eBPF_o11y)
thousanda
1
110
ASP.NETアプリケーションのモダナイゼーションについて
tomokusaba
0
250
Ruby on Railroad: The Power of Visualizing CFG
ydah
0
300
監視 やばい
syossan27
12
10k
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Being A Developer After 40
akosma
91
590k
How STYLIGHT went responsive
nonsquared
100
5.5k
Automating Front-end Workflow
addyosmani
1370
200k
What's in a price? How to price your products and services
michaelherold
245
12k
The Cult of Friendly URLs
andyhume
78
6.3k
GraphQLとの向き合い方2022年版
quramy
46
14k
Speed Design
sergeychernyshev
29
930
The World Runs on Bad Software
bkeepers
PRO
68
11k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
A designer walks into a library…
pauljervisheath
205
24k
Transcript
20.01.2016 Forget Objective-C. Start Swift. for Kharkiv Mobile Devs #15
Alexey Demedetskiy ✤ twitter: @DAlooG ✤ email: dalog@me.com ✤ 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