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
iO
Search
Yuka Ezura
November 20, 2016
0
75
iO
Yuka Ezura
November 20, 2016
Tweet
Share
More Decks by Yuka Ezura
See All by Yuka Ezura
Mastering share sheet preview
ezura
4
1.3k
SF Symbols
ezura
9
1.2k
気遣いの iOS プログラミング
ezura
11
3.3k
Secret Swift tour
ezura
7
2.8k
Swift Album ver.4.1
ezura
3
1.4k
Swift と Kotlin
ezura
4
2.5k
哲学とSwiftの発表
ezura
5
570
アプリが動いたその先へ (iOS アプリ開発編)
ezura
1
950
Blending Kotlin's culture into Swift
ezura
1
1.2k
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
1
39
Designing for humans not robots
tammielis
249
25k
KATA
mclloyd
29
13k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Building an army of robots
kneath
302
42k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Done Done
chrislema
181
16k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
What's in a price? How to price your products and services
michaelherold
243
12k
Building Adaptive Systems
keathley
38
2.2k
Transcript
iOS ք۾ Swift3 Ҡߦͷҋ ezura
iOS ΤϯδχΞͷਓ
iOS ΤϯδχΞͱࣄͯ͠Δਓ
·ͩɺଉͯ͠·͔͢ (´ɾωɾʆ)ʁ
"\(self)" • ezura • iOS ΤϯδχΞ • ࠷ۙ Swift2 ͔Β
Swift3 ͷҠߦͷ͓ࣄ
"\(self)" • ezura • iOS ΤϯδχΞ • ࠷ۙ Swift2 ͔Β
Swift3 ͷҠߦͷ͓ࣄ
͍͑ͨ͜ͱ
Swift3 ରԠ͍ͯ͠ͳ͍ iOS ΤϯδχΞͷํ ֮ޛ͍ͯͩ͘͠͞
iOS ΤϯδχΞͱࣄ͍ͯ͠Δํ ԾʹɺSwift3 Ҡߦͷਐḿ͕ѱͯ͘ ͝ཧղͷ΄ͲɺΑΖ͓͘͠ئ͍͠·͢…
Index • ҋʹࢸΔܦҢ • ҋΛΓӽ͑ΔͨΊʹ • Swift3 ͷॻ͖͑ޙʹൃੜͨ͜͠ͱ
ҋʹࢸΔܦҢ
Ή͔͠Ή͔͠ɺ iOS ΞϓϦ Objective-C ͱ͍͏ݴޠͰ ॻ͘͜ͱ͕ඪ४Ͱͨ͠
ಥવͷͷܒࣔ
Swift ͱ͍͏ݴޠΛ࡞ͬͨΑ ࠓޙ͜ΕΛਪ͍ͯ͘͠Α
༷ͷ࣊͝൵
(ͨͩ͠ɺ੍ݶ͋Γ) Objective-C ͱ Swift ૬ޓʹݺͼग़͢͜ͱ͕Ͱ͖·͢ Ὃ طଘͷίʔυͦͷ··༻Մೳ
͔ͯ͘͠ɺ iOS ΞϓϦ Objective-C ͱ Swift ͷ ࠞࡏ͢ΔੈքͱͳΓ·ͨ͠
৽͘͠ॻ͘෦ Swift2 ʹ͠Α͏ ͱ͍͏ྲྀΕ
طଘͷίʔυ Swift2 ʹஔ͖͑Α͏ͱ͍͏ಈ͖
ฏ͕๚Ε…
Swift3 ϦϦʔε ഁյతΞοϓσʔτ
Xcode8.2 (࣍ͷόʔδϣϯ) Λ ࠷ޙʹ Swift2 ͷαϙʔτΛΔΑ
Swift3 ͷҠߦۙʑඞਢʹ
ͱ͍͑ɺ3 ͘Β͍ͰऴΘΔͰ͠ΐʁ Conversion πʔϧ͋Δ͠…
Θͨ͋ΊͷΑ͏ʹ͍ߟ͑Ͱͨ͠
Error 0 200 400 600 800 1 2
3 4 5 6 7 8 9 Τϥʔ (ୀࣾ࣌)
Կ͕͋ͬͨͷ͔ • ҰʹΤϥʔΛݕग़Ͱ͖ͳ͍ • ίϯόʔδϣϯπʔϧ͕·ͱʹಈ͔ͳ͍ • Swift ͱ Objective-C ͷ࿈ܞͷมߋ༝དྷͰɺةݥͳ
෦͕͋Δ • ϥΠϒϥϦ෦ͷมߋશͯࣗͰ • ϥϯλΠϜΤϥʔɺҙਤ͠ͳ͍ڍಈͷରԠ
Կ͕͋ͬͨͷ͔ • ҰʹΤϥʔΛݕग़Ͱ͖ͳ͍ • ίϯόʔδϣϯπʔϧ͕·ͱʹಈ͔ͳ͍ • Swift ͱ Objective-C ͷ࿈ܞͷมߋ༝དྷͰɺةݥͳ
෦͕͋Δ • ϥΠϒϥϦ෦ͷมߋશͯࣗͰ • ϥϯλΠϜΤϥʔɺҙਤ͠ͳ͍ڍಈͷରԠ
Error 0 200 400 600 800 1 2
3 4 5 6 7 8 9 Τϥʔ (ୀࣾ࣌)
ҋΛΓӽ͑ΔͨΊʹ
Swift2 ͷ͏͔ͪΒରࡦ͢Δ
Swift2 Ͱॻ͍͍ͯΔਓ • Swift ίʔσΟϯάΨΠυϥΠϯʹଇͬͯॻ͍͓ͯ ͖·͠ΐ͏ • Objective-C ͱͷ࿈ܞͰ IUO
ΛΘͣ Optional Ͱ ѻ͏Α͏ʹ͠·͠ΐ͏ (nullability ΞϊςʔγϣϯΛࢦఆ͍ͯ͠ͳ͍߹) • RxSwift ͷഇࢭ༧ఆͷϝιου (`onNext` ) ΛΘ ͳ͍Α͏ʹ͠·͠ΐ͏
ॻ͖·ͨ͠ʂ٩( 'ω' )و ࠓɺSwift2 Ͱॻ͍͍ͯΔಉ๔ୡɻ࠷ݶͬ ͓͖͍ͯͨɺSwift2 ͷ··Ͱ࢝ΊΔ Swift3 ରࡦ
Swift3 Ҡߦ్தͷਓ ಉࢤΑɺ͕Μͬͯ
Swift3 ίϯύΠϧΤϥʔղܾͷ ޙஊ
ϥϯλΠϜΤϥʔ • NSURL ͱ URL • Objective-C ͷδΣωϦοΫܕʹ Swift ͔ΒΞΫηε
(Swift2 Ͱେৎͩͬͨ…) • Objective-C Realm ࢮ͢ (ݹ͍όʔδϣϯͩͬͨͷཁҼ) • ϚΠάϨʔγϣϯπʔϧ͕ͱΓ͋͑ͣ `!` ͚ͭͯͨ
༧ظͤ͵ڍಈ • protocol ͷϝιου໊ͷม࿙Ε (optional ࢦఆ default ࣮͍ͯ͠Δϝιουͩͱ ؾ͕͖ͭʹ͍͘) •
ϚΠάϨʔγϣϯπʔϧ͕ྑ͘ͳ͍Ωϟετͯ͠Δ
·ͱΊ
• ༧Ҏ্ʹ Swift3 ରԠʹ͕͔͔࣌ؒΔ • Swift2 ͷ͏͔ͪΒ Swift3 Λҙࣝͯ͠ॻ͍͓ͯ͘ͱָ •
ίϯύΠϧΤϥʔղܾͷ͋ͱɺ৽ͨͳઓ͍͕࢝·Δ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠