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
Core NFC の新機能 / What's new in Core NFC (WWDC20)
Search
treastrain / Tanaka Ryoga
July 09, 2020
Programming
2
710
Core NFC の新機能 / What's new in Core NFC (WWDC20)
集まれSwift好き!Swift愛好会スピンオフ WWDC20セッション要約会 @ Online で発表した LT「Core NFC の新機能」です。
treastrain / Tanaka Ryoga
July 09, 2020
Tweet
Share
More Decks by treastrain / Tanaka Ryoga
See All by treastrain / Tanaka Ryoga
Mastering AsyncSequence - 使う・作る・他のデザインパターン(クロージャ、Delegate など)から移行する
treastrain
5
2.3k
Firebase Apple SDK 年間ダイジェスト: 2023年 / Firebase Apple SDK Annual Digest: 2023
treastrain
1
1.8k
Combine・sink(RxSwift・subscribe)では Task を作らないようにして async なメソッドを呼ぶ / Do not create a Task inside a Combine/sink (RxSwift/subscribe) closure when calling an async method there
treastrain
2
950
その Swift コード、 こう書き換えてみないか / Polishing your Swift code with me!
treastrain
2
8k
存在型に `any` を付けていないときにコンパイルエラーにする / How to produce a compile error when writing an existential type without the `any` keyword
treastrain
1
4.5k
Bitrise Pipelines に移行して、クレジットを節約しながら並列でビルド・テストを回す / Migrate to Bitrise Pipelines and save credits while run builds and tests in parallel
treastrain
0
2.2k
詳解 Core NFC - NFC を用いた iOS App 開発のてびき / Demystify Core NFC - A guide to iOS App Dev using NFC
treastrain
5
4k
プロフィールページ(ポートフォリオサイト)を Swift-DocC で作れるか? / Can we create a profile page (portfolio site) in Swift-DocC?
treastrain
1
250
あらゆる情報を 楽に正しく String にフォーマットする 〜令和2021年から脱却せよ〜 / Easily and correctly format any information into a String
treastrain
6
2.1k
Other Decks in Programming
See All in Programming
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
280
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
210
CSC509 Lecture 09
javiergs
PRO
0
140
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
850
macOS でできる リアルタイム動画像処理
biacco42
9
2.3k
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Contemporary Test Cases
maaretp
0
130
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
イベント駆動で成長して委員会
happymana
1
320
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
Realtime API 入門
riofujimon
0
150
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
110
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
GraphQLとの向き合い方2022年版
quramy
43
13k
Thoughts on Productivity
jonyablonski
67
4.3k
KATA
mclloyd
29
14k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Statistics for Hackers
jakevdp
796
220k
Designing the Hi-DPI Web
ddemaree
280
34k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Transcript
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE MPWF@TXJGU ू·Ε4XJGU͖ʂ4XJGUѪձεϐϯΦϑ88%$ηογϣϯཁձ!0OMJOF+VMZ $PSF/'$ʹؔ͢Δ৽ػೳ 8IBUTOFXJO$PSF/'$ USFBTUSBJO5BOBLB3ZPHB !USFBTUSBJO
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE USFBTUSBJO5BOBLB3ZPHB 4XJGU J04 XBUDI04 $PSF/'$ 044 ɹɹɹɹɹɹɹɹɹɹ!USFBTUSBJOɹIUUQTUSFUKQ
ߴઐʢʣେֶʢʣ৽ଔʢʣ ੜ·Εͯ͡Ίͯຊ֨తʹऔΓΜͩ ϓϩάϥϛϯάݴޠ4XJGU ࣗݾհ
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE +BQBO/'$3FBEFS J1IPOFͰిࢠϚωʔͷ ߴɾར༻ཤྺͷಡΈऔΓ J1IPOFͰಡΈऔͬͨཤྺΛ J$MPVEܦ༝ͰଞͷσόΠε͔Β֬ೝͰ͖Δ ݄ϦϦʔεɹμϯϩʔυ, !+BQBO/'$3FBEFS J1IPOFͰిࢠϚωʔͷߴΛνΣοΫ
J04"QQ
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE IUUQTHJUIVCDPNUSFBTUSBJO53&5+BQBO/'$3FBEFS +BQBO/'$3FBEFSͷίΞ෦Λ044Խͨ͠ϥΠϒϥϦ ӡస໔ڐূϚΠφϯόʔΧʔυͷҰ෦༰ͷಡΈऔΓ *OJUJBMDPNNJU݄ɹ4UBST!݄࣌ 53&5+BQBO/'$3FBEFS .*5-JDFODF 044-JCSBSZ
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE /FBS'JFME$PNNVOJDBUJPO ۙڑແઢ௨৴
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE ৗʹ༹͚ࠐΉ/'$ ͋ͳͨͷपΓʹ/'$ w ඇ৮ܾࡁ ΫϨδοτΧʔυͷίϯλΫτϨεܾࡁ ϓϦϖΠυܕͷిࢠϚωʔʢަ௨ܥɺҰൠతͳফඅܥʣ w ຊਓ֬ೝ ݸਓ൪߸ʢϚΠφϯόʔʣΧʔυɹɹӡస໔ڐূɹɹύεϙʔτ
ֶੜূɹɹࣾһূ w σʔλͷަ "OESPJE#FBN "OESPJE*$4d1JF
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE J1IPOFͰ/'$Λ͏ $PSF/'$
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE "QQ$MJQTͰ$PSF/'$Θͳ͍ J04Ͱ͑ΔίϯύΫτͳ"QQ w "QQ$MJQTΛ։͘ w /'$ w 23ίʔυ w
Ϛοϓʢۙͷݕࡧʣ w 4JSJ͔ΒͷఏҊ w 4BGBSJ w ϝοηʔδ w "QQ$MJQίʔυ w /'$ɾ23ίʔυͷத 6OJWFSTBM-JOLT w J04ଆ͕ಡΈऔͬͯॲཧ͢Δ $PSF/'$ͷ࣮ඞཁͳ͠
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE $PSF/'$ʹؔ͢Δ৽ػೳ 8IBUTOFXJO$PSF/'$ XXED w $PSF/'$ͷ֓ཁ 0WFSWJFX w 4XJGUͰͷߏจͷมߋ 4ZOUBYDIBOHFT
w *40λά͚ͷϝιουΛՃ *40BEEJUJPOT
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE $PSF/'$ʹؔ͢Δ৽ػೳ 8IBUTOFXJO$PSF/'$ XXED w $PSF/'$ͷ֓ཁ 0WFSWJFX w 4XJGUͰͷߏจͷมߋ 4ZOUBYDIBOHFT
w *40λά͚ͷϝιουΛՃ *40BEEJUJPOT
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE 3FTVMUΛͬͨ4XJGUߏจ .PEFSO4XJGUTZOUBYXJUI3FTVMU w J04ҎલͷNFCFeliCaTagͷྫ &YBNQMFPGNFCFeliCaTagCFGPSFJ04 detectedFeliCaTag.readWithoutEncryption( serviceCodeList: serviceCodeList,
blockList: blockList) { ( statusFlag1: Int, statusFlag2: Int, blockData: [Data], error: Error?) in if let error = error { // Handle error. return } // Handle status flag 1, status flag 2 and block data }
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE 3FTVMUΛͬͨ4XJGUߏจ .PEFSO4XJGUTZOUBYXJUI3FTVMU w J04Ҏ߱ͷNFCFeliCaTagͷྫ &YBNQMFPGNFCFeliCaTagBGUFSJ04 detectedFeliCaTag.readWithoutEncryption( serviceCodeList: serviceCodeList,
blockList: blockList) { ( response: Result<(NFCFeliCaStatusFlag, [Data]), Error>) in switch response { case .success((let statusFlag, let blockData)): // Handle NFCFeliCaStatusFlag object and block data case .failure(let error): // Handle Error object. } }
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE detectedFeliCaTag.readWithoutEncryption( serviceCodeList: serviceCodeList, blockList: blockList) { ( statusFlag1: Int,
statusFlag2: Int, blockData: [Data], error: Error?) in if let error = error { session.invalidate(errorMessage: error.localizedDescription) } guard statusFlag1 == 0x00, statusFlag2 == 0x00 else { session.invalidate( errorMessage: "εςʔλεϑϥά͕ΤϥʔΛ͍ࣔͯ͠·͢ɻ\(statusFlag1), \(statusFlag2)") return } let data = blockData.first! let balance = Int(data[11]) + Int(data[12]) << 8 session.alertMessage = "ߴ: ¥\(balance)" session.invalidate() } ަ௨ܥ*$ΧʔυͷߴΛಡΈऔΔ J04Ҏલͷ߹ɹcompletionHandler
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE detectedFeliCaTag.readWithoutEncryption( serviceCodeList: serviceCodeList, blockList: blockList) { ( response: Result<(NFCFeliCaStatusFlag,
[Data]), Error>) in switch response { case .success((let statusFlag, let blockData)): guard statusFlag.statusFlag1 == 0x00, statusFlag.statusFlag2 == 0x00 else { session.invalidate(errorMessage: "εςʔλεϑϥά͕ΤϥʔΛ͍ࣔͯ͠·͢ɻ\(statusFlag)") return } let data = blockData.first! let balance = Int(data[11]) + Int(data[12]) << 8 session.alertMessage = "ߴ: ¥\(balance)" session.invalidate() case .failure(let error): session.invalidate(errorMessage: error.localizedDescription) } } ަ௨ܥ*$ΧʔυͷߴΛಡΈऔΔ J04Ҏલͷ߹ɹresultHandler
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE Մಡੑ্ͷͨΊͷFOVNͷมߋ .PSFEFTDSJQUJWFFOVNT w FOVNͷ໊শมߋ 3FOBNFTPGUIFTFFOVNT w PollingRequestCodeNFCFeliCaPollingRequestCode w PollingTimeSlot
NFCFeliCaPollingTimeSlot w EncryptionId NFCFeliCaEncryptionId w NFCISO15693ɺNFCISO7816͚ʹ໊শมߋɾՃ͋Γ 0UIFSOFXFOVNT
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE ࠓΠϯύΫτগͳΊ J04Ͱͷ$PSF/'$ͷϝιουՃͱൺֱͯ͠ w J04Ͱͷ$PSF/'$ʮωΠςΟϒλάΞΫηεͷՃʯ J04·ͰܾΊΒΕͨϑΥʔϚοτʢ/%&'ʣͷΈ ωΠςΟϒϓϩτίϧʢ*40ɺ'FMJ$Bɺ.*'"3&ͳͲʣ͕͑ΔΑ͏ʹ ɹిࢠϚωʔͷಡΈऔΓɺνϟʔδ ɹϚΠφϯόʔΧʔυͷಡΈऔΓɺॻ͖ࠐΈ
w J04Ͱ4XJGUͰͷߏจมߋͱ*40λά͚ͷػೳՃ *40*&$ʹରԠ ਤॻؗͷຊͷλάͳͲ
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE ئ͍Θͣ "QQMF8BUDIͰ$PSF/'$͕͑ΔΑ͏ʹʜͳΒͳ͔ͬͨ USFBTUSBJO5BOBLB3ZPHB !USFBTUSBJO ͍ͬͪͭ͜ͰେৎͰ͢Αʜʁ"QQMF͞Μʜʜʁ 88%$ΑΖ͓͘͠ئ͍͠·͢Ͷʜʜʜʁ ޕޙu݄u5XFFU%FDL
$PQZSJHIUUSFBTUSBJO5BOBLB3ZPHBɹ"MMSJHIUTSFTFSWFE ࢀߟใ ͋Γ͕ͱ͏͍͟͝·ͨ͠ w ຊεϥΠυ4QFBLFS%FDLʹͯӾཡͰ͖·͢ IUUQTTQFBLFSEFDLDPNUSFBTUSBJO w ຊεϥΠυͰͷαϯϓϧίʔυΛ(JU)VC(JTUͰެ։͍ͯ͠·͢ IUUQTHJTUHJUIVCDPNUSFBTUSBJOGFDFGBCFFD w
88%$7JEFPT w $PSF/'$&OIBODFNFOUT88%$ IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED w 8IBUTOFXJO$PSF/'$88%$ IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED