Last active
April 23, 2020 07:04
-
-
Save mukyasa/a631aab280ae780d7b7ed52be4499c3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol EventProtocol { | |
| var name: String { get set } | |
| var params: [String: Any] { get set } | |
| } | |
| @propertyWrapper | |
| struct Event: EventProtocol { | |
| var name: String | |
| var params: [String: Any] = [:] | |
| var wrappedValue: Event { | |
| return Event(name: name, | |
| params: params) | |
| } | |
| } | |
| // Helper init methods | |
| extension Event { | |
| init(screenValue: String) { | |
| self.init(name: EventName.screenVisit, | |
| params: [ParameterName.screen: screenValue]) | |
| } | |
| init(clickValue: String) { | |
| self.init(name: EventName.clickEvent, | |
| params: [ParameterName.click: clickValue]) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment