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
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
210
Rediscovering The Swift Compiler Through Closures
avielg
0
59
Other Decks in Programming
See All in Programming
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
130
Pull-Requestの内容を1クリックで動作確認可能にするワークフロー
natmark
2
490
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
160
Your Perfect Project Setup for Angular @BASTA! 2025 in Mainz
manfredsteyer
PRO
0
160
CI_CD「健康診断」のススメ。現場でのボトルネック特定から、健康診断を通じた組織的な改善手法
teamlab
PRO
0
210
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
0
110
私はどうやって技術力を上げたのか
yusukebe
43
18k
CSC509 Lecture 04
javiergs
PRO
0
300
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
Cursorハンズオン実践!
eltociear
2
1k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
250
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
72
11k
Music & Morning Musume
bryan
46
6.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
189
55k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
GitHub's CSS Performance
jonrohan
1032
470k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
RailsConf 2023
tenderlove
30
1.2k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
114
20k
Unsuck your backbone
ammeep
671
58k
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