-
-
Save maximkrouk/9b91dfc21ef61bf42f52b2813320b984 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 | |
public struct CodingKeys: CodingKey { | |
public var stringValue: String | |
public init(stringValue: String) { | |
self.stringValue = stringValue | |
} | |
@available(*, deprecated, message: "Always fails.") | |
public init?(intValue: Int) { nil } | |
public var intValue: Int? { .none } | |
public static func custom(_ value: String) -> Self { .init(stringValue: value) } | |
} | |
extension CodingKeys: ExpressibleByStringLiteral { | |
public init(stringLiteral value: String) { | |
self = .custom(value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Back to index