Skip to content

Commit

Permalink
Lower minimum OS requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
Qata committed Feb 18, 2022
1 parent 79344b8 commit a8b6fae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
<integer>2</integer>
</dict>
<key>Tutorial (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>4</integer>
<integer>3</integer>
</dict>
<key>Tutorial (Playground) 3.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>1</integer>
<integer>4</integer>
</dict>
<key>Tutorial (Playground) 4.xcscheme</key>
<dict>
Expand All @@ -49,7 +49,7 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>2</integer>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// swift-tools-version:5.5
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "MonadicJSON",
platforms: [
.macOS(.v12), .iOS(.v15), .watchOS(.v8), .tvOS(.v15),
.macOS(.v10_10), .iOS(.v8), .watchOS(.v2), .tvOS(.v9),
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
Expand Down
10 changes: 8 additions & 2 deletions Sources/MonadicJSON/JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ extension Null: Codable {
}
}

public struct JSONDecimalError: Error {
}

public indirect enum JSON: Hashable, Codable {
case null
case string(String)
Expand All @@ -43,15 +46,18 @@ public indirect enum JSON: Hashable, Codable {
case object([String: JSON])
case array([JSON])

public func encodable() throws -> some Encodable {
public func encodable() throws -> Encodable {
func recurse(json: JSON) throws -> AnyEncodable {
switch json {
case let .object(value):
return try .init(value.mapValues(recurse))
case let .array(value):
return try .init(value.map(recurse))
case let .number(value):
return try .init(Decimal(value, format: .number))
guard let decimal = Decimal(string: value) else {
throw JSONDecimalError()
}
return .init(decimal)
case let .string(value):
return .init(value)
case let .bool(value):
Expand Down
22 changes: 0 additions & 22 deletions Tests/Info.plist

This file was deleted.

0 comments on commit a8b6fae

Please sign in to comment.