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
120
[社内勉強会]Parchment-swiftの実装説明
自身が作成したライブラリをプロダクトに導入していくにあたって、メンバに実装を共有するために作った資料の一部です
k-kohey
March 08, 2022
Tweet
Share
More Decks by k-kohey
See All by k-kohey
ゲームボーイアドバンスでSwiftを動かそう
k_koheyi
0
900
Swift Package Mangerのバグを直した話
k_koheyi
2
1.4k
swift-async-algorithms...? へえ…面白そうじゃん…?
k_koheyi
3
1.5k
[社内勉強会]Combineの説明
k_koheyi
0
29
あるインスタンスの取る値が 何パターンあるか数えてみるンゴ!
k_koheyi
1
140
Tuistを用いた Xcode Project管理の紹介
k_koheyi
0
180
SwiftでわかるSOLID原則 iOSDC 2020
k_koheyi
3
2.7k
Visitorパターン
k_koheyi
0
150
Application Design 勉強会23-25章
k_koheyi
0
62
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
RailsConf 2023
tenderlove
29
970
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
Become a Pro
speakerdeck
PRO
26
5.1k
What's in a price? How to price your products and services
michaelherold
244
12k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Site-Speed That Sticks
csswizardry
3
270
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