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
Swifty Code: The Real World
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Aviel Gross
August 03, 2016
Programming
0
200
Swifty Code: The Real World
Keynote of the lecture given at iOS TLV Meetup on August 3 2016 by Aviel Gross
Twitter: @avielgr
Aviel Gross
August 03, 2016
Tweet
Share
More Decks by Aviel Gross
See All by Aviel Gross
SwiftUI Performance for Demanding Apps
avielg
0
220
Rediscovering The Swift Compiler Through Closures
avielg
0
62
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
15年目のiOSアプリを1から作り直す技術
teakun
1
620
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
420
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.3k
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
130
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
540
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
15
3k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
400
株式会社 Sun terras カンパニーデック
sunterras
0
2.1k
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
110
Fundamentals of Software Engineering In the Age of AI
therealdanvega
1
250
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
490
Featured
See All Featured
Between Models and Reality
mayunak
2
230
Leo the Paperboy
mayatellez
4
1.5k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
320
How GitHub (no longer) Works
holman
316
140k
4 Signs Your Business is Dying
shpigford
187
22k
Mobile First: as difficult as doing things right
swwweet
225
10k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
450
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
82
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
170
Transcript
SWIFTY SWIFTIFICATIONS FOR SWIFT SWIFTTIBUTES *Texts in this keynote where
written in some fonts that are not San-Francisco, please accept my sincere apology.
Swifty Code
None
OO IS OLD! PROTOCOL ORIENTED IS GOLD! USE STRUCTS NOT
CLASSES! IT’S NOT FUNCTIONAL ENOUGH! I HEARD APPLE HAS THAT NEW SWIFT LANG…WHATS ALL THAT ABOUT?
None
None
None
None
None
None
None
None
None
None
None
None
None
None
Class or Struct?!
MAINLY LOGIC OR MODEL? CLASS Logic Model BIG/NOT- SELF CHANGES?
Yes CLASS No STRUCT MIGHT WORK REFERENC ING A CLASS? Yes CLASS No
The Almighty Swift Enum
Swift ❤ enums - Holds values (even named!) - $
Can implement Protocols - Very light! (both on syntax and system)
Swift ❤ enums - Knows who he is!
Swift ❤ enums - Check for specific case
Swift ❤ enums - Or handle all of them +
their values
Swift ❤ enums Enums can even be your model!
Swift ❤ enums TL;DR Use Enums! And don’t buy a
MBA
try/catch Quoted from hackingwithswift.com/new-syntax-swift-2-error-handling-try-catch
Guard
Spot the success! Quoted from nshipster.com/guard-and-defer
Quoted from nshipster.com/guard-and-defer
Use Guard - Verify condition/unwrap needed optional - Early failure
- empty/zero/default result Don’t Use Guard - ‘else’ has logic - Entire func is a tiny if-else
Defer
None
Custom Operations
- associativity & precedence - val X val X val
- X= version - Accepts optionals? - Returns optional? - $ test
None
☝
Overloading
None
“Don't leave "broken windows" unrepaired. ” - The Pragmatic Programmer
Not var! Use “half dynamic” lets
Not string! Use the new #selector
use Swift switch Change this…..
To This: use Swift switch
FAKE IT FAKE IT UNTIL YOU MAKE IT