-
-
Save cardoso/19c15f67f091836bc9a63be2fa4a1286 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
import Foundation | |
struct AuthRequest: Codable { | |
let appleUid: String | |
let appleAuthCode: String | |
let name: String? | |
func encoded() -> Data { | |
try! JSONEncoder().encode(self) | |
} | |
} | |
struct AuthResponse: Codable { | |
let apiKey: String | |
let streamId: String | |
let streamToken: String | |
let email: String | |
let name: String? | |
init?(data: Data) { | |
guard let res = try? JSONDecoder().decode(AuthResponse.self, from: data) else { | |
return nil | |
} | |
self = res | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment