Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iO

6a55a7fb19c1fa78e86ddca7a69db088?s=47 Yuka Ezura
November 20, 2016
56

 iO

6a55a7fb19c1fa78e86ddca7a69db088?s=128

Yuka Ezura

November 20, 2016
Tweet

Transcript

  1. iOS ք۾
 Swift3 Ҡߦͷҋ ezura

  2. iOS ΤϯδχΞͷਓ

  3. iOS ΤϯδχΞͱ࢓ࣄͯ͠Δਓ

  4. ·ͩɺଉͯ͠·͔͢ (´ɾωɾʆ)ʁ

  5. "\(self)" • ezura • iOS ΤϯδχΞ • ࠷ۙ͸ Swift2 ͔Β

    Swift3 ΁ͷҠߦͷ͓࢓ࣄ
  6. "\(self)" • ezura • iOS ΤϯδχΞ • ࠷ۙ͸ Swift2 ͔Β

    Swift3 ΁ͷҠߦͷ͓࢓ࣄ
  7. ఻͍͑ͨ͜ͱ

  8. Swift3 ରԠ͍ͯ͠ͳ͍
 iOS ΤϯδχΞͷํ
 
 ֮ޛ͍ͯͩ͘͠͞

  9. iOS ΤϯδχΞͱ࢓ࣄ͍ͯ͠Δํ
 
 ԾʹɺSwift3 Ҡߦͷਐḿ͕ѱͯ͘΋
 ͝ཧղͷ΄ͲɺΑΖ͓͘͠ئ͍͠·͢…

  10. Index • ҋʹࢸΔܦҢ • ҋΛ৐Γӽ͑ΔͨΊʹ • Swift3 ΁ͷॻ͖׵͑ޙʹൃੜͨ͜͠ͱ

  11. ҋʹࢸΔܦҢ

  12. Ή͔͠Ή͔͠ɺ
 iOS ΞϓϦ͸ Objective-C ͱ͍͏ݴޠͰ
 ॻ͘͜ͱ͕ඪ४Ͱͨ͠

  13. ಥવͷͷܒࣔ

  14. Swift ͱ͍͏ݴޠΛ࡞ͬͨΑ
 ࠓޙ͸͜ΕΛਪ͍ͯ͘͠Α

  15. ༷ͷ࣊͝൵

  16. (ͨͩ͠ɺ੍ݶ͋Γ) Objective-C ͱ Swift ͸
 ૬ޓʹݺͼग़͢͜ͱ͕Ͱ͖·͢
 Ὃ طଘͷίʔυ͸ͦͷ··࢖༻Մೳ

  17. ͔ͯ͘͠ɺ
 iOS ΞϓϦ͸ Objective-C ͱ Swift ͷ
 ࠞࡏ͢ΔੈքͱͳΓ·ͨ͠

  18. ৽͘͠ॻ͘෦෼͸ Swift2 ʹ͠Α͏
 ͱ͍͏ྲྀΕ

  19. طଘͷίʔυ΋ 
 Swift2 ʹஔ͖׵͑Α͏ͱ͍͏ಈ͖

  20. ฏ࿨͕๚Ε…

  21. Swift3 ϦϦʔε
 ௒ഁյతΞοϓσʔτ

  22. Xcode8.2 (࣍ͷόʔδϣϯ) Λ
 ࠷ޙʹ Swift2 ͷαϙʔτΛ੾ΔΑ

  23. Swift3 ΁ͷҠߦ͸ۙʑඞਢʹ

  24. ͱ͸͍͑ɺ3 ೔͘Β͍ͰऴΘΔͰ͠ΐʁ
 Conversion πʔϧ͋Δ͠…

  25. Θͨ͋ΊͷΑ͏ʹ؁͍ߟ͑Ͱͨ͠

  26. Error ਺ 0 200 400 600 800 ೔਺ 1 2

    3 4 5 6 7 8 9 Τϥʔ਺ (ୀࣾ࣌఺)
  27. Կ͕͋ͬͨͷ͔ • Ұ౓ʹΤϥʔΛݕग़Ͱ͖ͳ͍ • ίϯόʔδϣϯπʔϧ͕·ͱ΋ʹಈ͔ͳ͍ • Swift ͱ Objective-C ͷ࿈ܞͷมߋ༝དྷͰɺةݥͳ

    ෦෼͕͋Δ • ϥΠϒϥϦ෦෼ͷมߋ͸શͯࣗ෼Ͱ • ϥϯλΠϜΤϥʔɺҙਤ͠ͳ͍ڍಈͷରԠ
  28. Կ͕͋ͬͨͷ͔ • Ұ౓ʹΤϥʔΛݕग़Ͱ͖ͳ͍ • ίϯόʔδϣϯπʔϧ͕·ͱ΋ʹಈ͔ͳ͍ • Swift ͱ Objective-C ͷ࿈ܞͷมߋ༝དྷͰɺةݥͳ

    ෦෼͕͋Δ • ϥΠϒϥϦ෦෼ͷมߋ͸શͯࣗ෼Ͱ • ϥϯλΠϜΤϥʔɺҙਤ͠ͳ͍ڍಈͷରԠ
  29. Error ਺ 0 200 400 600 800 ೔਺ 1 2

    3 4 5 6 7 8 9 Τϥʔ਺ (ୀࣾ࣌఺)
  30. ҋΛ৐Γӽ͑ΔͨΊʹ

  31. Swift2 ͷ͏͔ͪΒରࡦ͢Δ

  32. Swift2 Ͱॻ͍͍ͯΔਓ • Swift ίʔσΟϯάΨΠυϥΠϯʹଇͬͯॻ͍͓ͯ ͖·͠ΐ͏ • Objective-C ͱͷ࿈ܞͰ IUO

    Λ࢖Θͣ Optional Ͱ ѻ͏Α͏ʹ͠·͠ΐ͏
 (nullability ΞϊςʔγϣϯΛࢦఆ͍ͯ͠ͳ͍৔߹) • RxSwift ͷഇࢭ༧ఆͷϝιου (`onNext` ౳) Λ࢖Θ ͳ͍Α͏ʹ͠·͠ΐ͏
  33. ॻ͖·ͨ͠ʂ٩( 'ω' )و ࠓɺSwift2 Ͱॻ͍͍ͯΔಉ๔ୡ΁ɻ࠷௿ݶ΍ͬ ͓͖͍ͯͨɺSwift2 ͷ··Ͱ࢝ΊΔ Swift3 ରࡦ

  34. Swift3 Ҡߦ్தͷਓ ಉࢤΑɺ͕Μ͹ͬͯ

  35. Swift3 ίϯύΠϧΤϥʔղܾͷ
 ޙ೔ஊ

  36. ϥϯλΠϜΤϥʔ • NSURL ͱ URL • Objective-C ͷδΣωϦοΫܕʹ Swift ͔ΒΞΫηε


    (Swift2 Ͱ͸େৎ෉ͩͬͨ…) • Objective-C Realm ࢮ͢
 (ݹ͍όʔδϣϯͩͬͨͷ΋ཁҼ) • ϚΠάϨʔγϣϯπʔϧ͕ͱΓ͋͑ͣ `!` ͚ͭͯͨ
  37. ༧ظͤ͵ڍಈ • protocol ͷϝιου໊ͷม׵࿙Ε
 (optional ࢦఆ΍ default ࣮૷͍ͯ͠Δϝιουͩͱ ؾ͕͖ͭʹ͍͘) •

    ϚΠάϨʔγϣϯπʔϧ͕ྑ͘ͳ͍Ωϟετͯ͠Δ
  38. ·ͱΊ

  39. • ༧૝Ҏ্ʹ Swift3 ରԠʹ͸͕͔͔࣌ؒΔ • Swift2 ͷ͏͔ͪΒ Swift3 Λҙࣝͯ͠ॻ͍͓ͯ͘ͱָ •

    ίϯύΠϧΤϥʔղܾͷ͋ͱ΋ɺ৽ͨͳઓ͍͕࢝·Δ
  40. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠