$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Swift2 New Features
Search
Tomohiro MITSUMUNE
August 14, 2015
Programming
0
140
Swift2 New Features
社内向けの発表資料。
あまりiOSさわったことない人向けの解説です。
Tomohiro MITSUMUNE
August 14, 2015
Tweet
Share
More Decks by Tomohiro MITSUMUNE
See All by Tomohiro MITSUMUNE
某サービスのリニューアルでECSを導入したよもやま話
tmitz
1
2.8k
5分でわかるAdequateRecord
tmitz
1
470
Other Decks in Programming
See All in Programming
愛される翻訳の秘訣
kishikawakatsumi
1
320
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
380
チームをチームにするEM
hitode909
0
310
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
230
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
120
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
210
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
160
【CA.ai #3】Google ADKを活用したAI Agent開発と運用知見
harappa80
0
300
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
500
Developing static sites with Ruby
okuramasafumi
0
270
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
630
How Software Deployment tools have changed in the past 20 years
geshan
0
29k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Designing for humans not robots
tammielis
254
26k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Side Projects
sachag
455
43k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
What's in a price? How to price your products and services
michaelherold
246
12k
Navigating Team Friction
lara
191
16k
Done Done
chrislema
186
16k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
Transcript
Swift2 New Features @t_mitz 2015/08/12
Agenda • Error Handling • Protocol Extension • New keywords
& Renamed syntax • Swift-er SDK
Error Handling • do ~ catch ͱ try Λ͏ •
ॏཁɿྫ֎ॲཧͰͳ͍Ͱ͢ • ࠓ·ͰͷNSErrorͷΓํͷSyntax Sugerͱߟ ͑ͯΒͬͯΑͦ͞͏
Error Type • enumܕͰΤϥʔλΠϓΛఆٛ
Throwing Errors • func ~ throws {} ͰΤϥʔΛ͛ΔՄೳੑͷ͋ ΔfuncΛఆٛ͢Δ
Catching & Handling Errors • do ~ catchͷதͰ try func()
ͯ͠catchͰΤϥʔ Λर͏
ͳʹ͕͏Ε͍͠ͷ͔ • طଘͷΤϥʔϋϯυϦϯά • NSErrorͷϙΠϯλ͠Ͱ͕ΜΔ • ਖ਼ৗܥͱҟৗܥ͕΄ͲΑࠞ͘͟Γ͍͢ • ίʔυॻ͘ਓͷηϯε࣍ୈ •
୭͕ॻ͍ͯਖ਼ৗܥɾҟৗܥ͕͞ΕΔίʔυʹͳ ΔͷεςΩ
Protocol Extension
Protocol • JavaͰ͍͏Interface
Protocol Extension • protocolʹରͯ͠ॳظϝιουΛՃͰ͖Δ
ݺͼग़͠ͷ݁Ռ
ͳʹ͕͏Ε͍͠ͷ͔ • SwiftͰඪ४Ͱఆٛ͞ΕΔΦϒδΣΫτ ProtocolΛ࣮ͬͯ͞Ε͍ͯΔ • ඪ४ProtocolϢʔβʔ͕ExtensionՄೳ • ֦ுϥΠϒϥϦͭ͘Δͱ͖ʹΜΓ
New Keywords
guard • ͍ΘΏΔΨʔυઅ͕ॻ͚Δ܅ • assign͞ΕΔ͕nilͩͬͨΒείʔϓͷ ॲཧʹೖΔ • if let ~
ͱͷҧ͍assignʹޭ͢Δͱείʔ ϓͷ֎Ͱ͑Δ͜ͱ
guard statement
defer • ݱࡏͷείʔϓΛൈ͚ΔલͰݺΕΔ • Error Handlingͱ߹Θͤͯ͏ͱ͖Finallyͱ ͯ͑͠Δ • cleanupॲཧΛॻ͖͍ͨͱ͖ʹΜΓ
defer statement
available • OSͷόʔδϣϯͰذͤ͞Δ܅ • iOS 8.4 ͱ͔ϚΠφʔόʔδϣϯ
repeat • ͍ΘΏΔ do ~ whileจ
Any Question?