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
Rails Girls Zürich Keynote
gr2m
94
13k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Building an army of robots
kneath
302
44k
Scaling GitHub
holman
458
140k
Speed Design
sergeychernyshev
25
670
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Typedesign – Prime Four
hannesfritz
40
2.4k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
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