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
Swift2 New Features
Search
Tomohiro MITSUMUNE
August 14, 2015
Programming
0
120
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.5k
5分でわかるAdequateRecord
tmitz
1
440
Other Decks in Programming
See All in Programming
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
170
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
820
使ってみよう Azure AI Document Intelligence
kosmosebi
2
300
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
130
VS Code をプロダクトにどう取り込むか
onomax
1
360
코틀린으로 멀티플랫폼 만들기
pangmoo
0
150
Node.js v22 で変わること
yosuke_furukawa
PRO
9
3.1k
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
2
120
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
GitHub Copilotのススメ
marcy731
1
200
新宿ダンジョンを可視化してみた
satoshi7190
2
240
Featured
See All Featured
Fireside Chat
paigeccino
21
2.6k
4 Signs Your Business is Dying
shpigford
175
21k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
121
39k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
Mobile First: as difficult as doing things right
swwweet
216
8.6k
Build The Right Thing And Hit Your Dates
maggiecrowley
24
2k
Code Reviewing Like a Champion
maltzj
514
39k
The Cost Of JavaScript in 2023
addyosmani
16
3.9k
How to name files
jennybc
65
93k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
21
1.6k
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?