Skip to content

Commit

Permalink
Make Any+Codable extensions public
Browse files Browse the repository at this point in the history
  • Loading branch information
iabudiab committed Apr 24, 2021
1 parent 3ccc5dc commit e68a89f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Sources/Codable/Any+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ import Foundation

// MARK: - JSONCodingKeys

struct JSONCodingKeys: CodingKey {
var stringValue: String
var intValue: Int?
public struct JSONCodingKeys: CodingKey {
public var stringValue: String
public var intValue: Int?

init?(stringValue: String) {
public init?(stringValue: String) {
self.stringValue = stringValue
}

init?(intValue: Int) {
public init?(intValue: Int) {
self.init(stringValue: "\(intValue)")
self.intValue = intValue
}
}

extension KeyedDecodingContainer {
public extension KeyedDecodingContainer {

func decode(_ type: [String: Any].Type, forKey key: K) throws -> [String: Any] {
let container = try nestedContainer(keyedBy: JSONCodingKeys.self, forKey: key)
Expand Down Expand Up @@ -112,7 +112,7 @@ extension KeyedDecodingContainer {
}
}

extension UnkeyedDecodingContainer {
public extension UnkeyedDecodingContainer {

mutating func decode(_ type: [String: Any].Type) throws -> [String: Any] {
let container = try nestedContainer(keyedBy: JSONCodingKeys.self)
Expand Down Expand Up @@ -156,7 +156,7 @@ extension UnkeyedDecodingContainer {
}
}

extension KeyedEncodingContainerProtocol where Key == JSONCodingKeys {
public extension KeyedEncodingContainerProtocol where Key == JSONCodingKeys {

mutating func encode(_ value: [String: Any]) throws {
for (key, value) in value {
Expand Down Expand Up @@ -207,7 +207,7 @@ extension KeyedEncodingContainerProtocol where Key == JSONCodingKeys {
}
}

extension KeyedEncodingContainerProtocol {
public extension KeyedEncodingContainerProtocol {

mutating func encode(_ value: [String: Any]?, forKey key: Key) throws {
guard let value = value else { return }
Expand All @@ -224,7 +224,7 @@ extension KeyedEncodingContainerProtocol {
}
}

extension UnkeyedEncodingContainer {
public extension UnkeyedEncodingContainer {

mutating func encode(_ value: [String: Any]) throws {
var container = nestedContainer(keyedBy: JSONCodingKeys.self)
Expand Down

0 comments on commit e68a89f

Please sign in to comment.