From 60e21e93d6f16cf8f132d7efab6be44e582703e1 Mon Sep 17 00:00:00 2001 From: Tanner Date: Wed, 9 Aug 2017 19:53:32 -0400 Subject: [PATCH] Revert "Beta" --- Sources/Node/Core/NodeRepresentable.swift | 17 +++-------------- .../StructuredDataWrapper+Convenience.swift | 12 ++---------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/Sources/Node/Core/NodeRepresentable.swift b/Sources/Node/Core/NodeRepresentable.swift index 28babba..36213f1 100644 --- a/Sources/Node/Core/NodeRepresentable.swift +++ b/Sources/Node/Core/NodeRepresentable.swift @@ -15,21 +15,10 @@ extension NodeRepresentable { - returns: convertible representation of object */ public func converted( - to type: T.Type, + to type: T.Type = T.self, in context: Context? - ) throws -> T { - return try converted(in: context) as T - } - - /// Map the node back to a convertible type - /// - /// - parameter type: the type to map to -- can be inferred - /// - throws: if mapping fails - /// - returns: convertible representation of object - public func converted( - in context: Context? - ) throws -> T { + ) throws -> T { let node = try makeNode(in: context) - return try T.init(node: node) + return try type.init(node: node) } } diff --git a/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Convenience.swift b/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Convenience.swift index ffa3227..eac33dc 100644 --- a/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Convenience.swift +++ b/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Convenience.swift @@ -24,19 +24,11 @@ extension StructuredDataWrapper { self.init(wrapped, in: Self.defaultContext) } - public func converted(to type: T.Type) -> T { + public func converted(to type: T.Type = T.self) -> T { return T(wrapped, in: context) } - public func converted() -> T { - return T(wrapped, in: context) - } - - public func converted(to type: T.Type) throws -> T { - return try T.init(node: self) - } - - public func converted() throws -> T { + public func converted(to type: T.Type = T.self) throws -> T { return try T.init(node: self) }