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
57
Other Decks in Programming
See All in Programming
Tool Catalog Agent for Bedrock AgentCore Gateway
licux
6
2.4k
そのAPI、誰のため? Androidライブラリ設計における利用者目線の実践テクニック
mkeeda
2
280
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
200
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
Kiroで始めるAI-DLC
kaonash
2
580
CloudflareのChat Agent Starter Kitで簡単!AIチャットボット構築
syumai
2
480
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
4
1.4k
「待たせ上手」なスケルトンスクリーン、 そのUXの裏側
teamlab
PRO
0
500
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
120
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
110
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
We Have a Design System, Now What?
morganepeng
53
7.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Docker and Python
trallard
45
3.6k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Why Our Code Smells
bkeepers
PRO
339
57k
A designer walks into a library…
pauljervisheath
207
24k
Embracing the Ebb and Flow
colly
87
4.8k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
For a Future-Friendly Web
brad_frost
180
9.9k
A Modern Web Designer's Workflow
chriscoyier
696
190k
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