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
800
Swift Package Mangerのバグを直した話
k_koheyi
2
1.3k
swift-async-algorithms...? へえ…面白そうじゃん…?
k_koheyi
3
1.4k
[社内勉強会]Combineの説明
k_koheyi
0
28
あるインスタンスの取る値が 何パターンあるか数えてみるンゴ!
k_koheyi
1
140
Tuistを用いた Xcode Project管理の紹介
k_koheyi
0
170
SwiftでわかるSOLID原則 iOSDC 2020
k_koheyi
3
2.7k
Visitorパターン
k_koheyi
0
140
Application Design 勉強会23-25章
k_koheyi
0
61
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Code Review Best Practice
trishagee
65
17k
A Philosophy of Restraint
colly
203
16k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
BBQ
matthewcrist
85
9.4k
Typedesign – Prime Four
hannesfritz
40
2.4k
Building Applications with DynamoDB
mza
91
6.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Become a Pro
speakerdeck
PRO
26
5k
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