refactored naming

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-08-22 17:43:12 -05:00
parent 052d7b57b0
commit 6156ed18fd

View File

@ -37,12 +37,12 @@ public protocol Withable {
/// 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 func with(_ closure: (_ instance: inout T) -> Void) -> T
@discardableResult func copyWith(_ closure: (_ instance: inout T) -> Void) -> T
}
public extension Withable {
@discardableResult func with(_ closure: (_ instance: inout Self) -> Void) -> Self {
@discardableResult func copyWith(_ closure: (_ instance: inout Self) -> Void) -> Self {
var copy = self
closure(&copy)
return copy