diff --git a/JSONAPI.playground/Pages/Usage.xcplaygroundpage/Contents.swift b/JSONAPI.playground/Pages/Usage.xcplaygroundpage/Contents.swift index 25b0235..cdd90fe 100644 --- a/JSONAPI.playground/Pages/Usage.xcplaygroundpage/Contents.swift +++ b/JSONAPI.playground/Pages/Usage.xcplaygroundpage/Contents.swift @@ -49,11 +49,15 @@ print("-----") // MARK: - Pass successfully parsed body to other parts of the code +/* + ---- CRASHING IN XCODE 10.2 PLAYGROUND ---- + if case let .data(bodyData) = peopleResponse.body { print("first person's name: \(bodyData.primary.values[0][\.fullName])") } else { print("no body data") } + */ // MARK: - Work in the abstract diff --git a/JSONAPI.playground/contents.xcplayground b/JSONAPI.playground/contents.xcplayground index e240eff..3da156e 100644 --- a/JSONAPI.playground/contents.xcplayground +++ b/JSONAPI.playground/contents.xcplayground @@ -1,5 +1,5 @@ - + diff --git a/JSONAPI.podspec b/JSONAPI.podspec index fe4dd9a..a87f919 100644 --- a/JSONAPI.podspec +++ b/JSONAPI.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "JSONAPI" - spec.version = "0.19.0" + spec.version = "0.20.0" spec.summary = "Swift Codable JSON API framework." # This description is used to generate tags and improve search results. @@ -132,10 +132,10 @@ See the JSON API Spec here: https://jsonapi.org/format/ # where they will only apply to your library. If you depend on other Podspecs # you can include multiple dependencies to ensure it works. - spec.swift_version = "4.2" + spec.swift_version = "5.0" # spec.requires_arc = true # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } - spec.dependency "Poly", "~> 1.1" + spec.dependency "Poly", "~> 2.0" end diff --git a/Package.resolved b/Package.resolved index 920f7b5..fac7812 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/mattpolzin/Poly.git", "state": { "branch": null, - "revision": "77f45b8963a51c02d71fc4075eba5cff47ff0d07", - "version": "1.0.0" + "revision": "d24d4c1214dd05f89eb1182a46592856dd0a0645", + "version": "2.0.0" } } ] diff --git a/Package.swift b/Package.swift index 8f0d1b8..0789b25 100644 --- a/Package.swift +++ b/Package.swift @@ -1,10 +1,14 @@ -// swift-tools-version:4.2 +// 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: "JSONAPI", + platforms: [ + .macOS(.v10_10), + .iOS(.v10) + ], products: [ .library( name: "JSONAPI", @@ -14,7 +18,7 @@ let package = Package( targets: ["JSONAPITesting"]) ], dependencies: [ - .package(url: "https://github.com/mattpolzin/Poly.git", from: "1.0.0"), + .package(url: "https://github.com/mattpolzin/Poly.git", from: "2.0.0"), ], targets: [ .target( @@ -30,5 +34,5 @@ let package = Package( name: "JSONAPITestingTests", dependencies: ["JSONAPI", "JSONAPITesting"]) ], - swiftLanguageVersions: [.v4_2] + swiftLanguageVersions: [.v5] ) diff --git a/Sources/JSONAPI/Result.swift b/Sources/JSONAPI/Result.swift deleted file mode 100644 index 326bdcc..0000000 --- a/Sources/JSONAPI/Result.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// Result.swift -// JSONAPI -// -// Created by Mathew Polzin on 12/5/18. -// - -enum Result { - case success(T) - case failure(E) - - var value: T? { - guard case .success(let val) = self else { - return nil - } - return val - } - - var error: E? { - guard case .failure(let err) = self else { - return nil - } - return err - } - - func map(_ transform: (T) -> U) -> Result { - switch self { - case .failure(let err): - return .failure(err) - case .success(let val): - return .success(transform(val)) - } - } -} - -extension Result: CustomStringConvertible where T: CustomStringConvertible, E: CustomStringConvertible { - var description: String { - switch self { - case .success(let val): - return String(describing: val) - case .failure(let err): - return String(describing: err) - } - } -} diff --git a/Tests/JSONAPITests/Poly/PolyProxyTests.swift b/Tests/JSONAPITests/Poly/PolyProxyTests.swift index 01dcfb6..a294f4e 100644 --- a/Tests/JSONAPITests/Poly/PolyProxyTests.swift +++ b/Tests/JSONAPITests/Poly/PolyProxyTests.swift @@ -86,10 +86,10 @@ public extension PolyProxyTests { public typealias Relationships = NoRelationships } - public typealias UserA = BasicEntity - public typealias UserB = BasicEntity + typealias UserA = BasicEntity + typealias UserB = BasicEntity - public typealias User = Poly2 + typealias User = Poly2 } extension Poly2: EntityProxy, JSONTyped where A == PolyProxyTests.UserA, B == PolyProxyTests.UserB {