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
220
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
86
Self managed teams 101
dalog
0
130
Other Decks in Programming
See All in Programming
ErdMap: Thinking about a map for Rails applications
makicamel
1
680
令和7年版 あなたが使ってよいフロントエンド機能とは
mugi_uno
10
5.3k
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
190
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
250
Amazon Nova Reelの可能性
hideg
0
200
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
190
情報漏洩させないための設計
kubotak
5
1.3k
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
140
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
390
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
600
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
180
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Navigating Team Friction
lara
183
15k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Music & Morning Musume
bryan
46
6.3k
A designer walks into a library…
pauljervisheath
205
24k
Code Reviewing Like a Champion
maltzj
521
39k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Writing Fast Ruby
sferik
628
61k
Rails Girls Zürich Keynote
gr2m
94
13k
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