diff --git a/Sources/SpellbookFoundation/Common/Extensions - Codable.swift b/Sources/SpellbookFoundation/Common/Extensions - Codable.swift index 36b2222..0665b73 100644 --- a/Sources/SpellbookFoundation/Common/Extensions - Codable.swift +++ b/Sources/SpellbookFoundation/Common/Extensions - Codable.swift @@ -51,21 +51,21 @@ public struct ObjectEncoder { } extension ObjectEncoder where T: Encodable { - public static func json(_ type: T.Type = T.self, encoder: JSONEncoder = JSONEncoder()) -> Self { + public static func json(type: T.Type = T.self, encoder: JSONEncoder = JSONEncoder()) -> Self { .init(name: "json", encode: encoder.encode) } - public static func json(_ type: T.Type = T.self, formatting: JSONEncoder.OutputFormatting) -> Self { + public static func json(type: T.Type = T.self, _ formatting: JSONEncoder.OutputFormatting) -> Self { let encoder = JSONEncoder() encoder.outputFormatting = formatting return .json(encoder: encoder) } - public static func plist(_ type: T.Type = T.self, encoder: PropertyListEncoder = PropertyListEncoder()) -> Self { + public static func plist(type: T.Type = T.self, encoder: PropertyListEncoder = PropertyListEncoder()) -> Self { .init(name: "plist", encode: encoder.encode) } - public static func plist(_ type: T.Type = T.self, format: PropertyListSerialization.PropertyListFormat) -> Self { + public static func plist(type: T.Type = T.self, _ format: PropertyListSerialization.PropertyListFormat) -> Self { let encoder = PropertyListEncoder() encoder.outputFormat = format return .plist(encoder: encoder) @@ -73,11 +73,11 @@ extension ObjectEncoder where T: Encodable { } extension ObjectEncoder { - public static func foundationJSON(_ type: T.Type = T.self, options: JSONSerialization.WritingOptions = []) -> Self { + public static func foundationJSON(type: T.Type = T.self, _ options: JSONSerialization.WritingOptions = []) -> Self { .init(name: "json") { try JSONSerialization.data(withJSONObject: $0, options: options) } } - public static func foundationPlist(_ type: T.Type = T.self, format: PropertyListSerialization.PropertyListFormat) -> Self { + public static func foundationPlist(type: T.Type = T.self, _ format: PropertyListSerialization.PropertyListFormat) -> Self { .init(name: "plist") { try PropertyListSerialization.data(fromPropertyList: $0, format: format, options: 0) } } } diff --git a/Sources/SpellbookFoundation/Filesystem & Bundle/FileStore.swift b/Sources/SpellbookFoundation/Filesystem & Bundle/FileStore.swift index d596e82..7f60934 100644 --- a/Sources/SpellbookFoundation/Filesystem & Bundle/FileStore.swift +++ b/Sources/SpellbookFoundation/Filesystem & Bundle/FileStore.swift @@ -154,10 +154,10 @@ public struct FileStoreCoder { extension FileStoreCoder { public static func json(_ formatting: JSONEncoder.OutputFormatting = []) -> Self { - .init(encoder: .json(formatting: formatting), decoder: .json()) + .init(encoder: .json(formatting), decoder: .json()) } public static func plist(_ format: PropertyListSerialization.PropertyListFormat = .xml) -> Self { - .init(encoder: .plist(format: format), decoder: .plist()) + .init(encoder: .plist(format), decoder: .plist()) } } diff --git a/Sources/SpellbookHTTP/HTTPRequest.swift b/Sources/SpellbookHTTP/HTTPRequest.swift index f140e03..d383e32 100644 --- a/Sources/SpellbookHTTP/HTTPRequest.swift +++ b/Sources/SpellbookHTTP/HTTPRequest.swift @@ -133,19 +133,19 @@ extension HTTPRequest.Body { } public static func foundation(json obj: Any, options: JSONSerialization.WritingOptions = []) -> Self { - .init(value: obj, encoder: .foundationJSON(options: options), contentType: contentTypeJSON) + .init(value: obj, encoder: .foundationJSON(options), contentType: contentTypeJSON) } public static func foundation(plist obj: Any, format: PropertyListSerialization.PropertyListFormat = .xml) -> Self { - .init(value: obj, encoder: .foundationPlist(format: format), contentType: contentTypePlist) + .init(value: obj, encoder: .foundationPlist(format), contentType: contentTypePlist) } public static func codable(json obj: T, formatting: JSONEncoder.OutputFormatting = []) -> Self { - .init(value: obj, encoder: .json(formatting: formatting), contentType: contentTypeJSON) + .init(value: obj, encoder: .json(formatting), contentType: contentTypeJSON) } public static func codable(plist obj: T, format: PropertyListSerialization.PropertyListFormat = .xml) -> Self { - .init(value: obj, encoder: .plist(format: format), contentType: contentTypePlist) + .init(value: obj, encoder: .plist(format), contentType: contentTypePlist) } public static func data(_ data: Data, contentType: String?) -> Self {