-
-
Save anonymous/498030a95a6f74cf03942935a59e68e7 to your computer and use it in GitHub Desktop.
This file contains 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
struct PayloadTransform: TransformType { | |
typealias Object = [DCNotificationPayloadKey: Any] | |
typealias JSON = [String: Any] | |
func transformFromJSON(_ value: Any?) -> [DCNotificationPayloadKey: Any]? { | |
guard let value = value as? [String: Any] else { | |
return [:] | |
} | |
var result = [AppNotificationPayloadKey: Any]() | |
for (key, value) in value { | |
if let payloadKey = DCNotificationPayloadKey(rawValue: key) { | |
result[payloadKey] = value | |
} | |
} | |
return result | |
} | |
func transformToJSON(_ value: [DCNotificationPayloadKey: Any]?) -> [String: Any]? { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment