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
We Have a Design System, Now What?
morganepeng
50
7.2k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
GraphQLとの向き合い方2022年版
quramy
43
13k
Navigating Team Friction
lara
183
14k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Optimizing for Happiness
mojombo
376
70k
Making Projects Easy
brettharned
115
5.9k
Visualization
eitanlees
145
15k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
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