From fb710c397b5458290ccff850a12fdf494cf30df1 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Tue, 16 Apr 2019 21:56:49 -0700 Subject: [PATCH] Entirely remove Result type that not only is unneeded with Swift 5 but also was not being used by this library (it was left over from before Poly became its own library). Fix a few redundent public warnings. --- Sources/JSONAPI/Result.swift | 45 -------------------- Tests/JSONAPITests/Poly/PolyProxyTests.swift | 6 +-- 2 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 Sources/JSONAPI/Result.swift 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 {