Skip to content

Instantly share code, notes, and snippets.

@GeorgeLyon
Created October 19, 2021 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeorgeLyon/7b18d6a35e85803241b31b2668fb9cf9 to your computer and use it in GitHub Desktop.
Save GeorgeLyon/7b18d6a35e85803241b31b2668fb9cf9 to your computer and use it in GitHub Desktop.
// MARK: - Encoding
public struct <#Name#>Encoder: Encoder {
public let codingPath: [CodingKey]
public var userInfo: [CodingUserInfoKey: Any]
public func container<Key: CodingKey>(keyedBy type: Key.Type) -> Swift.KeyedEncodingContainer<Key> {
<#code#>
}
public func unkeyedContainer() -> Swift.UnkeyedEncodingContainer {
<#code#>
}
public func singleValueContainer() -> Swift.SingleValueEncodingContainer {
<#code#>
}
public struct KeyedEncodingContainer<Key: CodingKey>: Swift.KeyedEncodingContainerProtocol {
public let codingPath: [CodingKey]
public mutating func encodeNil(forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Bool, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: String, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Double, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Float, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Int, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Int8, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Int16, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Int32, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: Int64, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: UInt, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: UInt8, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: UInt16, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: UInt32, forKey key: Key) throws {
<#code#>
}
public mutating func encode(_ value: UInt64, forKey key: Key) throws {
<#code#>
}
public mutating func encode<T: Encodable>(_ value: T, forKey key: Key) throws {
<#code#>
}
public mutating func nestedContainer<NestedKey: CodingKey>(
keyedBy keyType: NestedKey.Type,
forKey key: Key
) -> KeyedEncodingContainer<NestedKey> {
<#code#>
}
public mutating func nestedUnkeyedContainer(forKey key: Key) -> Swift.UnkeyedEncodingContainer {
<#code#>
}
public mutating func superEncoder() -> Swift.Encoder {
<#code#>
}
public mutating func superEncoder(forKey key: Key) -> Swift.Encoder {
<#code#>
}
}
public struct UnkeyedEncodingContainer: Swift.UnkeyedEncodingContainer {
public let codingPath: [CodingKey]
public var count: Int
public mutating func encodeNil() throws {
<#code#>
}
public mutating func encode(_ value: Bool) throws {
<#code#>
}
public mutating func encode(_ value: String) throws {
<#code#>
}
public mutating func encode(_ value: Double) throws {
<#code#>
}
public mutating func encode(_ value: Float) throws {
<#code#>
}
public mutating func encode(_ value: Int) throws {
<#code#>
}
public mutating func encode(_ value: Int8) throws {
<#code#>
}
public mutating func encode(_ value: Int16) throws {
<#code#>
}
public mutating func encode(_ value: Int32) throws {
<#code#>
}
public mutating func encode(_ value: Int64) throws {
<#code#>
}
public mutating func encode(_ value: UInt) throws {
<#code#>
}
public mutating func encode(_ value: UInt8) throws {
<#code#>
}
public mutating func encode(_ value: UInt16) throws {
<#code#>
}
public mutating func encode(_ value: UInt32) throws {
<#code#>
}
public mutating func encode(_ value: UInt64) throws {
<#code#>
}
public mutating func encode<T: Encodable>(_ value: T) throws {
<#code#>
}
public mutating func nestedContainer<NestedKey: CodingKey>(
keyedBy keyType: NestedKey.Type
) -> Swift.KeyedEncodingContainer<NestedKey> {
<#code#>
}
public mutating func nestedUnkeyedContainer() -> Swift.UnkeyedEncodingContainer {
<#code#>
}
public mutating func superEncoder() -> Swift.Encoder {
<#code#>
}
}
public struct SingleValueEncodingContainer: Swift.SingleValueEncodingContainer {
public let codingPath: [CodingKey]
public mutating func encodeNil() throws {
<#code#>
}
public mutating func encode(_ value: Bool) throws {
<#code#>
}
public mutating func encode(_ value: String) throws {
<#code#>
}
public mutating func encode(_ value: Double) throws {
<#code#>
}
public mutating func encode(_ value: Float) throws {
<#code#>
}
public mutating func encode(_ value: Int) throws {
<#code#>
}
public mutating func encode(_ value: Int8) throws {
<#code#>
}
public mutating func encode(_ value: Int16) throws {
<#code#>
}
public mutating func encode(_ value: Int32) throws {
<#code#>
}
public mutating func encode(_ value: Int64) throws {
<#code#>
}
public mutating func encode(_ value: UInt) throws {
<#code#>
}
public mutating func encode(_ value: UInt8) throws {
<#code#>
}
public mutating func encode(_ value: UInt16) throws {
<#code#>
}
public mutating func encode(_ value: UInt32) throws {
<#code#>
}
public mutating func encode(_ value: UInt64) throws {
<#code#>
}
public mutating func encode<T>(_ value: T) throws where T : Encodable {
<#code#>
}
}
}
// MARK: - Decoding
public struct <#Name#>Decoder: Swift.Decoder {
public let codingPath: [CodingKey]
public var userInfo: [CodingUserInfoKey: Any]
public func container<Key: CodingKey>(keyedBy type: Key.Type) throws -> Swift.KeyedDecodingContainer<Key> {
<#code#>
}
public func unkeyedContainer() throws -> Swift.UnkeyedDecodingContainer {
<#code#>
}
public func singleValueContainer() throws -> Swift.SingleValueDecodingContainer {
<#code#>
}
public struct KeyedDecodingContainer<Key: CodingKey>: Swift.KeyedDecodingContainerProtocol {
public let codingPath: [CodingKey]
public var allKeys: [Key] {
<#code#>
}
public func contains(_ key: Key) -> Bool {
<#code#>
}
public func decodeNil(forKey key: Key) throws -> Bool {
<#code#>
}
public func decode(_ type: Bool.Type, forKey key: Key) throws -> Bool {
<#code#>
}
public func decode(_ type: String.Type, forKey key: Key) throws -> String {
<#code#>
}
public func decode(_ type: Double.Type, forKey key: Key) throws -> Double {
<#code#>
}
public func decode(_ type: Float.Type, forKey key: Key) throws -> Float {
<#code#>
}
public func decode(_ type: Int.Type, forKey key: Key) throws -> Int {
<#code#>
}
public func decode(_ type: Int8.Type, forKey key: Key) throws -> Int8 {
<#code#>
}
public func decode(_ type: Int16.Type, forKey key: Key) throws -> Int16 {
<#code#>
}
public func decode(_ type: Int32.Type, forKey key: Key) throws -> Int32 {
<#code#>
}
public func decode(_ type: Int64.Type, forKey key: Key) throws -> Int64 {
<#code#>
}
public func decode(_ type: UInt.Type, forKey key: Key) throws -> UInt {
<#code#>
}
public func decode(_ type: UInt8.Type, forKey key: Key) throws -> UInt8 {
<#code#>
}
public func decode(_ type: UInt16.Type, forKey key: Key) throws -> UInt16 {
<#code#>
}
public func decode(_ type: UInt32.Type, forKey key: Key) throws -> UInt32 {
<#code#>
}
public func decode(_ type: UInt64.Type, forKey key: Key) throws -> UInt64 {
<#code#>
}
public func decode<T: Decodable>(_ type: T.Type, forKey key: Key) throws -> T {
<#code#>
}
public func nestedContainer<NestedKey: CodingKey>(
keyedBy type: NestedKey.Type,
forKey key: Key
) throws -> Swift.KeyedDecodingContainer<NestedKey> {
<#code#>
}
public func nestedUnkeyedContainer(forKey key: Key) throws -> Swift.UnkeyedDecodingContainer {
<#code#>
}
public func superDecoder() throws -> Swift.Decoder {
<#code#>
}
public func superDecoder(forKey key: Key) throws -> Swift.Decoder {
<#code#>
}
}
public struct UnkeyedDecodingContainer: Swift.UnkeyedDecodingContainer {
public let codingPath: [CodingKey]
public var count: Int? {
<#code#>
}
public var isAtEnd: Bool {
<#code#>
}
public var currentIndex: Int {
<#code#>
}
public mutating func decodeNil() throws -> Bool {
<#code#>
}
public mutating func decode(_ type: Bool.Type) throws -> Bool {
<#code#>
}
public mutating func decode(_ type: String.Type) throws -> String {
<#code#>
}
public mutating func decode(_ type: Double.Type) throws -> Double {
<#code#>
}
public mutating func decode(_ type: Float.Type) throws -> Float {
<#code#>
}
public mutating func decode(_ type: Int.Type) throws -> Int {
<#code#>
}
public mutating func decode(_ type: Int8.Type) throws -> Int8 {
<#code#>
}
public mutating func decode(_ type: Int16.Type) throws -> Int16 {
<#code#>
}
public mutating func decode(_ type: Int32.Type) throws -> Int32 {
<#code#>
}
public mutating func decode(_ type: Int64.Type) throws -> Int64 {
<#code#>
}
public mutating func decode(_ type: UInt.Type) throws -> UInt {
<#code#>
}
public mutating func decode(_ type: UInt8.Type) throws -> UInt8 {
<#code#>
}
public mutating func decode(_ type: UInt16.Type) throws -> UInt16 {
<#code#>
}
public mutating func decode(_ type: UInt32.Type) throws -> UInt32 {
<#code#>
}
public mutating func decode(_ type: UInt64.Type) throws -> UInt64 {
<#code#>
}
public mutating func decode<T: Decodable>(_ type: T.Type) throws -> T {
<#code#>
}
public mutating func nestedContainer<NestedKey: CodingKey>(
keyedBy type: NestedKey.Type
) throws -> Swift.KeyedDecodingContainer<NestedKey> {
<#code#>
}
public mutating func nestedUnkeyedContainer() throws -> Swift.UnkeyedDecodingContainer {
<#code#>
}
public mutating func superDecoder() throws -> Swift.Decoder {
<#code#>
}
}
public struct SingleValueDecodingContainer: Swift.SingleValueDecodingContainer {
public let codingPath: [CodingKey]
public func decodeNil() -> Bool {
<#code#>
}
public func decode(_ type: Bool.Type) throws -> Bool {
<#code#>
}
public func decode(_ type: String.Type) throws -> String {
<#code#>
}
public func decode(_ type: Double.Type) throws -> Double {
<#code#>
}
public func decode(_ type: Float.Type) throws -> Float {
<#code#>
}
public func decode(_ type: Int.Type) throws -> Int {
<#code#>
}
public func decode(_ type: Int8.Type) throws -> Int8 {
<#code#>
}
public func decode(_ type: Int16.Type) throws -> Int16 {
<#code#>
}
public func decode(_ type: Int32.Type) throws -> Int32 {
<#code#>
}
public func decode(_ type: Int64.Type) throws -> Int64 {
<#code#>
}
public func decode(_ type: UInt.Type) throws -> UInt {
<#code#>
}
public func decode(_ type: UInt8.Type) throws -> UInt8 {
<#code#>
}
public func decode(_ type: UInt16.Type) throws -> UInt16 {
<#code#>
}
public func decode(_ type: UInt32.Type) throws -> UInt32 {
<#code#>
}
public func decode(_ type: UInt64.Type) throws -> UInt64 {
<#code#>
}
public func decode<T: Decodable>(_ type: T.Type) throws -> T {
<#code#>
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment