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
Migrating to Swift 3 #kyoakiswift
Search
Takaaki Tanaka
February 08, 2017
Technology
0
2.7k
Migrating to Swift 3 #kyoakiswift
Kyobashi.swift x AKIBA.swift合同勉強会での発表資料です
#kyoakiswift
Takaaki Tanaka
February 08, 2017
Tweet
Share
More Decks by Takaaki Tanaka
See All by Takaaki Tanaka
製造の課題に立ち向かう Manufacturing Data Engine と Manufacturing Connect の ご紹介
kongmingstrap
0
620
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
590
JAWS-UG 福岡 #16 re:Invent 現地に行った人のお話 #jawsugfuk #jawsug
kongmingstrap
0
490
AppMod の開発のイマを知るために現地に潜入した私が見たものは・・・? #GoogleCloudNext
kongmingstrap
0
540
Kong Gateway から読みとく、 API統合・API連携サービスの最新情報 #devio2023
kongmingstrap
0
1.5k
Cloud Run に憧れて Google Cloud を推進している話 / CX事業本部で使われている技術
kongmingstrap
0
210
AWS / Google Cloud / Azure それぞれの推しサービス.pdf
kongmingstrap
0
1.3k
CPUブーストの話
kongmingstrap
0
53
私のAWS愛を聞け! ~ここが好きだよStep Functions~ #devio2022
kongmingstrap
0
1.1k
Other Decks in Technology
See All in Technology
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
180
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
420
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
140
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
500
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
430
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
180
強いチームと開発生産性
onk
PRO
35
11k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Faster Mobile Websites
deanohume
305
30k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
For a Future-Friendly Web
brad_frost
175
9.4k
Unsuck your backbone
ammeep
668
57k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
The Art of Programming - Codeland 2020
erikaheidi
52
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Transcript
ɹ2017/02/08 Kyobashi.swift x AKIBA.swift ߹ಉษڧձ Migrating to Swift 3
About Me
• ాத ໌ (Takaaki Tanaka) • Ϋϥεϝιουגࣜձࣾ • iOS ΞϓϦέʔγϣϯΤϯδχΞ
• @kongmingtrap • iOS Developer (Swift / Objective-C) • GyazSquare / GitHub
ͱ͋ΔΞϓϦͷ Swift 3ରԠ
ͱ͋ΔΞϓϦ • Swift 1.1ͷࠒ͔Β࡞ΒΕ͍ͯΔΞϓϦ • ॳظόʔδϣϯiOS 7ରԠ • Swift 1.2
→ 2.1ʹରԠ • ιʔείʔυɹ250ϑΝΠϧ • ϥΠϒϥϦཧCocoaPods
ϛογϣϯ iOS 10 ʹ ରԠηϤ
iOS 10 • Xcode ͷόʔδϣϯ8Ҏ্ • iOS SDK 10ΛΈࠐΉͨΊʹ Swift
2.3ɺ Swift 3.0ରԠ͕ඞཁ
Swift 3.0 • NS Prefix͔Βͷ٫ • ৽ͨͳΔAPIσβΠϯΨΠυϥΠϯ
Swift 3.0 • NS Prefix͔Βͷ٫ → Ұ෦Γ·ͨ͠ ʢNSNumberʣ • ৽ͨͳΔAPIσβΠϯΨΠυϥΠϯ
→ طଘ ͷϥΠϒϥϦͷϝιου໊มΘΓ͗͢ • ABI҆ఆԽ → Swift 4·ͰͬͯͶ
None
None
ʊਓਓਓਓਓਓਓਓਓʊ ʼɹࢼ͞ΕΔ৺ɹʻ ʉ:?:?:?:?:?:?:?:ʉ
Swift 2.3 • Xcode 8 + iOS 10 SDKͰϏϧυ͕Մೳ •
Swift 2.x ܥͷAPIσβΠϯ • ͱΓ͋͑ͣٸ͍ͰiOS 10ͰϏϧυ͠ͳ͚Ε ͳΒͳ͍࣌ʹରԠ
Swift 2.3 9DPEF3FMFBTF/PUFT • Xcode 8.2 ͕࠷ޙͷαϙʔτʹͳΔͨΊɺ Swift 3.0ͷରԠඞਢ
Swift 3.0Ҡߦ
Swift 2.2ͷҠߦ • Xcode 7.2 + Swift 2.1 ͷ։ൃڥΛXcode 8.2
Ͱىಈͨ͠ࡍɺʮEdit > Convert > To Current Swift Syntax.ʯͷରʹTarget͕දࣔ ͞Εͳ͔ͬͨ • ͱΓ͋͑ͣɺXcode 7.3ͰSwift 2.1͔ΒSwift 2.2Ҡߦͨ͠
Migration • Xcode 8.2Ͱىಈͨ͠ࡍɺաڈͷSwift όʔ δϣϯͷ߹Convertը໘͕ىಈ͢Δ • ʮEdit > Convert
> To Current Swift Syntax.ʯ Ͱ࣮ߦՄೳ • Swift 1.1 → Swift 2.1ͷ͍࣌ͷʹͳΒͳ ͔ͬͨ
None
None
ʊਓਓਓਓਓਓਓਓਓʊ ʼɹ$POWFSU'BJMFEɹʻ ʉ:?:?:?:?:?:?:?:?:?ʉ
Migration • Xcode 8.2Ͱىಈͨ͠ࡍɺաڈͷSwift όʔδϣ ϯͷ߹Convertը໘͕ىಈ͢Δ • ʮEdit > Convert
> To Current Swift Syntax.ʯͰ ࣮ߦՄೳ • Swift 1.1 → Swift 2.1ͷ͍࣌ͷʹͳΒͳ ͔ͬͨ • Swift 2.2 → Swift 3.0ͷ͍࣌ͷʹͳΒͳ ͔ͬͨ ← New!
ͦΕͰແ͍ΑΓϚγ • UIKitͷmethodͷม • Enumͷupper case → lower caseม •
NSPrefixͷϥΠϒϥϦͷม
ͻͨ͢Βಓͳ࡞ۀ • CurryԽͨ͠ϝιουͷमਖ਼ public static func log(level level: Level)(@autoclosure name:
() -> String) (@autoclosure message: () -> String) -> String { if level.rawValue <= Logger.currentLevel.rawValue { let full = "\(level.description): \(name()) - \(message())" print(full) return full } return "" }
ͻͨ͢Βಓͳ࡞ۀ • CurryԽͨ͠ϝιουͷमਖ਼ public static func log(level: Level) -> ((@escaping
() -> String) -> ((@escaping () -> String) -> String)) { return { (name: @escaping (() -> String)) in return { (message: @escaping (() -> String)) in if level.rawValue <= Logger.currentLevel.rawValue { let full = "\(level.description): \(name())) - \(message())" print(full) return full } return "" } } }
ͻͨ͢Βಓͳ࡞ۀ • closureʹ@escapingͷՃ
ͻͨ͢Βಓͳ࡞ۀ • Ҡߦπʔϧ͕มͨ͠Օॴͷमਖ਼ Date as NSDate as Date String as
NSString as String
ͻͨ͢Βಓͳ࡞ۀ • Testͷमਖ਼
None
Recap
w Ͱ͖ΕೋͱΓͨ͘ͳ͍ w ίϯϑϦΫτղফͷͨΊɺݽಠͳ࡞ۀ ͱͳΔ w ৺Λࢼ͞ΕΔ Recap
None
͋Γ͕ͱ͏͍͟͝·ͨ͠