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
import UIKit | |
/// A type eraser to erase the concrete types of your encodable objects | |
struct AnyEncodable: Encodable { | |
private let encodeClosure: (Encoder) throws -> Void | |
init<T: Encodable>(_ value: T) { | |
encodeClosure = { encoder in | |
try value.encode(to: encoder) | |
} |
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
/// Creates an AWS AppSync-compatible RequestBody `payload` for subscriptions. | |
/// This is necessary due to the different payload used by Apollo | |
/// Credit to: | |
/// - https://community.apollographql.com/t/using-apollo-with-appsync-directly-on-ios/324/4 | |
/// - https://docs.aws.amazon.com/appsync/latest/devguide/real-time-websocket-client.html#header-parameter-format-based-on-appsync-api-authorization-mode | |
/// - https://github.com/lingfengmarskey/NetworkSample | |
/// | |
/// AppSync payload: | |
/// { | |
/// "id": "subscriptionId", |
OlderNewer