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
190
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
130
Rediscovering The Swift Compiler Through Closures
avielg
0
53
Other Decks in Programming
See All in Programming
VS Code をプロダクトにどう取り込むか
onomax
1
370
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
140
Goのエラースタックトレースの歴史と今後
sonatard
9
1.5k
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
350
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
340
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
1
180
Hanami and htmx
bkuhlmann
0
210
見た目から始める生産性向上
ikumatadokoro
7
850
Tailwind CSSを本気でカスタマイズする方法
fsubal
13
5.3k
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
210
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
150
Featured
See All Featured
Producing Creativity
orderedlist
PRO
337
39k
Side Projects
sachag
451
41k
Building Flexible Design Systems
yeseniaperezcruz
319
37k
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
Teambox: Starting and Learning
jrom
128
8.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Bash Introduction
62gerente
604
210k
Being A Developer After 40
akosma
57
580k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
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