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
[社内勉強会]Parchment-swiftの実装説明
Search
k-kohey
March 08, 2022
0
110
[社内勉強会]Parchment-swiftの実装説明
自身が作成したライブラリをプロダクトに導入していくにあたって、メンバに実装を共有するために作った資料の一部です
k-kohey
March 08, 2022
Tweet
Share
More Decks by k-kohey
See All by k-kohey
ゲームボーイアドバンスでSwiftを動かそう
k_koheyi
0
760
Swift Package Mangerのバグを直した話
k_koheyi
2
1.3k
swift-async-algorithms...? へえ…面白そうじゃん…?
k_koheyi
3
1.4k
[社内勉強会]Combineの説明
k_koheyi
0
27
あるインスタンスの取る値が 何パターンあるか数えてみるンゴ!
k_koheyi
1
140
Tuistを用いた Xcode Project管理の紹介
k_koheyi
0
170
SwiftでわかるSOLID原則 iOSDC 2020
k_koheyi
3
2.6k
Visitorパターン
k_koheyi
0
130
Application Design 勉強会23-25章
k_koheyi
0
61
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Six Lessons from altMBA
skipperchong
27
3.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
Practical Orchestrator
shlominoach
186
10k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
How to Ace a Technical Interview
jacobian
276
23k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Transcript
1BSDINFOUTXJGUͷ࣮આ໌
γεςϜߏ ॲཧͷྲྀΕΛදͨ͠ਤ -PHHFS#VOEMFS -PHHFS" -PHHFS$ -PHHFS# &WFOU &WFOU &WFOU %JTQBUDI
&WFOU &WFOU &WFOU σϑΥϧτͰ ̍͝ͱʹ ϙʔϦϯά 4DIFEVMFS &WFOU &WFOU όοΫΤ ϯυ" &WFOU όοΫΤ ϯυ# &WFOU Πϕϯτൃੜ &WFOU .VUBUJPO &WFOU \ FWFOUlVTFS$SFBUFEz QSPQFSUJFT\ lOBNFzl5BSPz l04zlJ04z l7FSTJPOzlz l.PEFMzlJ1IPOF9z ^ ^ \ FWFOUlVTFS$SFBUFEz QSPQFSUJFT\ lOBNFzl5BSPz ^ ^ logger.send(.createdUser(“Taro”))
γεςϜߏ 5ZQFͷؔੑΛදͨ͠ਤ
ΠϯλϑΣʔε let logger = LoggerBundler( components: [MyLogger()] ) logger.send(.implession(“home")) //
enumͰOK extension TrackingEvent: Loggable { static func implession(_ screen: String) -> Self { TrackingEvent(eventName: "imp", parameters: ["screen": screen]) } } extension LoggerComponentID { static let my: Self = .init("My") } struct MyLogger: LoggerComponent { static var id: LoggerComponentID = .my func send(_ log: [LoggerSendable]) async -> Bool { print("send \(log)") return true } } όοΫΤϯυϩάΛૹ৴͢Δ -PHHFS$PNQPOFOUΛ࣮ ϩάใΛ٧ΊΔ5ZQFΛ -PHHBCMFʹ४ڌͯ͠ఆٛ TFOEϝιουΛ௨ͯ͠ &WFOUΛૹ৴
ओཁͳ5ZQF -PHHFS#VOEMFS w ϩάૹ৴ͷհ w ड͚औͬͨΠϕϯτΛ -PHHFS$PNQPOFOUୡʹ৴͢Δ w ड͚औͬͨΠϕϯτΛ#V ff
FSʹૹΔ͔ɺ -PHHFSʹૹΔ͔Λܾఆ͢Δ -PHHFS#VOEMFS -PHHFS -PHHFS -PHHFS &WFOU &WFOU &WFOU %JTQBUDI &WFOU &WFOU &WFOU
ओཁͳ5ZQF #V ff FSFE&WFOU'MVTI4DIFEVMFS w #V ff FS͔ΒͲ͏͍͏݅ͰཷΊࠐΜͩΠϕ ϯτΛर্͍͛Δ͔Λܾఆ͢Δׂ w
͜ͷ݅ෳࡶʹͳΓ͕ͪͰ͋Γɺॊೈ ੑΛٻΊΒΕΔ෦ w Ҿʹ#V ff FS͕͞ΕΔͷͰɺҙͷ݅ ͷ࣌ʹEFRVFVFͯ͠-PHHFSʹ͢ w σϑΥϧτͰ̍ຖʹϙʔϦϯά͢Δ࣮ ͕-PHHFSʹ%*͞ΕΔ public protocol BufferedEventFlushScheduler { func schedule( with buffer: TrackingEventBufferAdapter, didFlush: @escaping ([BufferRecord])->() ) } -PHHFS#VOEMFS 4DIFEVMFS &WFOU &WFOU ̽ඵຖʹ &WFOUΛLݸ ٵ্͍͛Δɺ &WFOU &WFOU &WFOU
ओཁͳ5ZQF .VUBUJPO w ͋ΔΠϕϯτΛผͷΠϕϯτมԽͤ͞Δ ׂ w ҉తʹ04ใσόΠε໊ΛΠϕϯτ ʹՃ͢ΔͨΊʹ༻ҙͨ͠ w ӈਤʢԼʣͷΑ͏ͳ5ZQFΛએݴ͓͚ͯ͠
উखʹύϥϝʔλʹՃ͞ΕΔΈ public struct DeviceDataMutation: Mutation { private let deviceParams = [ "Model": UIDevice.current.name, "OS": UIDevice.current.systemName, "OS Version": UIDevice.current.systemVersion ] public func transform( _ event: Loggable, id: LoggerComponentID ) -> Loggable { let log: LoggableDictonary = [ \.eventName: event.eventName, \.parameters: event.parameters.merging(deviceParams) { left, _ in left } ] return log } } -PHHFS .VUBUJPO &WFOU &WFOU -PHHFS#VOEMFS \ lPTzlJ04z l.PEFMz lJ1IPOFz lVTFSz5BSP ^ \ lVTFSz5BSP ^ 1BSBNFUFST