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
What's Up With Swift
Search
Mert Dumenci
December 14, 2014
Programming
0
110
What's Up With Swift
NSIstanbul Meetup 1.4
Mert Dumenci
December 14, 2014
Tweet
Share
Other Decks in Programming
See All in Programming
Semantic search with Django and pgvector
pauloxnet
0
240
try! Swift Tokyo 2024のLT枠に採択されたプロポーザルを出すときに考えていたこと
ski
0
340
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
180
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
300
Elm Form Validation
bkuhlmann
0
510
Front-end application development, Symfony-style(s)
dunglas
2
1.9k
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
educure_カリキュラム生操作マニュアル.pdf
linew_official
0
480
"config" ってなんだ? / What is "config"?
okashoi
0
220
Changed Rules: Architectures with Lightweight Stores
manfredsteyer
PRO
0
230
Folding Cheat Sheet #1
philipschwarz
PRO
0
210
Git Rebase
bkuhlmann
11
1.6k
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
91
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
226
16k
Building an army of robots
kneath
300
41k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
RailsConf 2023
tenderlove
2
530
Build The Right Thing And Hit Your Dates
maggiecrowley
23
2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
646
57k
A Tale of Four Properties
chriscoyier
150
22k
Music & Morning Musume
bryan
41
5.6k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
Large-scale JavaScript Application Architecture
addyosmani
503
110k
How GitHub (no longer) Works
holman
304
140k
Transcript
What’s up with Swift? $ diff Objective-C Swift
“Objective-C without the C”
“Objective-C without the C” A new language
Objective-C is heavily influenced by Smalltalk Objective-C is based on
messaging Objective-C is reflective
Swift is not heavily influenced by Smalltalk Swift is not
based on messaging Swift is limited in reflection
<objc/runtime.h>
objc_msgSend
Objective-C is dynamic (fun!) and safe enough by design
Swift is static and safe by design
Objective-C relies on the runtime for a lot of things
This makes it flexible But also hard to statically analyse
Swift relies on the compiler for a lot of things
This makes it not so flexible But also easy to statically analyse
Swift is not just a changed syntax
It’s a philosophy change
Swift is safe
Swift is concise
Swift is multi paradigm
Objective-C nil eats messages
There’s usually no need for explicit value existence checks
If nil means non-existent, so how do you represent existent
keys with no value in hashes?
[NSNull null]
@property (nonatomic, retain) NSMutableArray *array; [self.array addObject:@1]; NSNumber *value =
self.array.firstObject; Why is value nil?
nil, NSNull, silent failure
Optionals
enum Optional<T> { case None case Some(T) }
None
None
None
Type inference
let name = “Mert" let cities = ["Istanbul": 14_160_167, "Copenhagen":
559_557, "Tokyo": 13_350_000] let image = UIImage(named: "NSIstanbul")
Generics
None
func map<T, U>(array: [T], transform: (T) -> U) -> [U]
Theorems for free! Philip Wadler
Mutability as a language feature
Value types
First class functions
Pattern matching
…and many more
Swift is modern
Thanks
@mertdumenci
A lot of this presentation is from Functional Programming in
Swift — read it!
Couple of things
Objective-C is still a super awesome language, and it’s not
going anywhere anytime soon. It’s still incredibly relevant.
Swift is a concise and clean language. This doesn’t mean
it’s similar to JavaScript in any way. Don’t write JavaScript in Swift.
Swift has a long way to go. If you need
good reliability, use Objective-C.