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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
DAloG
January 14, 2016
Programming
140
1
Share
Start using Swift.
DAloG
January 14, 2016
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
240
Redux + MQTT
dalog
1
820
От задач к проблемам
dalog
1
290
Unlimited power of Data-Driven UI
dalog
4
690
Data-Driven View Controllers. Tips and Tricks
dalog
5
2k
2 years of Redux in iOS. Lessons learned
dalog
0
410
Why unidirectional architecture matter for iOS.
dalog
1
330
Mobile backend without REST
dalog
2
140
Self managed teams 101
dalog
0
200
Other Decks in Programming
See All in Programming
新規プロダクトを高速で生み出すハーネスエンジニアリング
seanchas116
15
6.9k
Migrations : C'est une question d'hygiène !
vinceamstoutz
0
2.4k
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
400
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.8k
Hive Metastoreを通して学ぶIceberg REST Catalog ― 仕様から実装まで
okumin
0
290
iOS26時代の新規アプリ開発
yuukiw00w
0
210
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
230
バックエンドにElysiaJSを採用して気付いた、良い点・悪い点
wanko_it
1
180
New "Type" system on PicoRuby
pocke
1
270
RTSPクライアントを自作してみた話
simotin13
0
300
横断組織出身のQAEがインプロセスQAEでつまずいたこと・活かせたこと
ty89
0
430
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
300
Featured
See All Featured
Everyday Curiosity
cassininazir
0
210
The Language of Interfaces
destraynor
162
26k
Side Projects
sachag
455
43k
Utilizing Notion as your number one productivity tool
mfonobong
4
310
Information Architects: The Missing Link in Design Systems
soysaucechin
0
940
Paper Plane
katiecoart
PRO
1
50k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
350
For a Future-Friendly Web
brad_frost
183
10k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
180
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
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