From 48a84960f4e39c0847261612edb8258bd3f0afab Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 23 Aug 2022 08:04:46 -0500 Subject: [PATCH] updated method Signed-off-by: Matt Bruce --- VDS/Protocols/Initable.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/VDS/Protocols/Initable.swift b/VDS/Protocols/Initable.swift index 05cb98d6..a16622be 100644 --- a/VDS/Protocols/Initable.swift +++ b/VDS/Protocols/Initable.swift @@ -12,12 +12,10 @@ public protocol Initable { } extension Withable where Self:Initable { - /// Provides a closure to configure instances inline. - /// - Parameter closure: A closure with a mutable copy of `self` as the argument. - /// - Returns: Simply returns the mutated copy of the instance after called the `closure`. - @discardableResult public static func initWith(_ closure: (_ instance: inout Self) -> Void) -> Self { - var copy = Self() - closure(©) - return copy + + /// Construct a new instance, setting an arbitrary subset of properties + public init(with closure: (inout Self) -> Void) { + self.init() + closure(&self) } }