How to migrate to Swift 4
Daiki Matsudate,@d_date, iOS Freelancer
Distribution GeekGarage
Slide 2
Slide 2 text
Daiki Matsudate,@d_date
• iOS Freelancer
• Supporting Realm as News Translator
• Organizer of CLEM (announce later)
• WWDC17 Attendee
Slide 3
Slide 3 text
Daiki Matsudate,@d_date
• iOS Freelancer
• Supporting Realm as News Translator
• Organizer of CLEM (announce later)
• WWDC17 Attendee
Slide 4
Slide 4 text
Agenda
• How to migrate to Swift 4 using Xcode 9 Beta
• [SE-0160] Limited @objc inference
• [SE-0110] Distinguish between single-tuple and
multiple-argument function types
• Renamed some constants
• Decodable
@objc in Swift 3.x
• Objective-CͰݺͼग़ͤΔͷʹ͍ͭͯɺSwiftଆͰ໌ࣔత
ʹએݴͰ͖Δ
• Θ͟Θ͟@objcΛॻ͔ͳ͍͍ͯ͘Α͏ʹ ਪͯ͘͠
ΕΔ
Slide 7
Slide 7 text
@objc in Swift 3.x ͷ
• Objective-CͰݺͼग़ͤΔͷʹ͍ͭͯɺSwiftଆͰ໌ࣔత
ʹએݴͰ͖Δ
• Θ͟Θ͟@objcΛॻ͔ͳ͍͍ͯ͘Α͏ʹ ਪͯ͘͠
ΕΔ → աͰʁʁ
Slide 8
Slide 8 text
• SwiftͷΫϥεObjective-CͷSelectorͷিಥΛҾ
͖ى͕ͪ͜͠
@objc in Swift 3.x ͷ
Slide 9
Slide 9 text
• Swift API Design GuidelineʹԊͬͯॻ͍ͯɺ
Objective-CͰݺͼग़͢ͱ͖ʹObjective-C
Coding Guidelineʹ͢Δ໊લʹม͞Ε͕ͪɻ
ಛʹɺinitializerɺͦͷ໊લʹୈҰҾΛؚΊͳ
͍͚ͯ͘ͳ͍ͷͰɺ@objcඞ͚ͣͭΔ͜ͱʹ
ͳΔɻ
@objc in Swift 3.x ͷ
Slide 10
Slide 10 text
• SwiftίϯύΠϥObjective-C Calling Convention
͔ΒSwift Calling Conventionม͢Δ"thunk"ϝ
ιουΛ࡞ΔͨΊɺόΠφϦαΠζ͕૿େ͢Δɻ
@objc in Swift 3.x ͷ
Slide 11
Slide 11 text
@objc in future
Slide 12
Slide 12 text
@objc in future
Objective-CͰඞཁͳͱ͜Ζ͚ͩʹ
@objcΛ͚ͭΔΑ͏ʹਪΛݮΒ͢
ʲํʳ