From 1f90ff1384b39ab3bf1abe0be6438138c8f1c855 Mon Sep 17 00:00:00 2001 From: maximkrouk Date: Sat, 17 Oct 2020 19:07:56 +0300 Subject: [PATCH] fix(Configurator): Config initializable autocompletion is now available --- Sources/FunctionalConfigurator/ConfigIntializable.swift | 4 ++-- Sources/FunctionalConfigurator/CustomConfigurable.swift | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/FunctionalConfigurator/ConfigIntializable.swift b/Sources/FunctionalConfigurator/ConfigIntializable.swift index 9e29928..9daa912 100644 --- a/Sources/FunctionalConfigurator/ConfigIntializable.swift +++ b/Sources/FunctionalConfigurator/ConfigIntializable.swift @@ -11,8 +11,8 @@ extension ConfigInitializable { /// Instantiates a new object with specified configuration /// /// Note: Type must implement custom intializer with no parameters, even if it inherits from NSObject - public init(_ configuration: (Config.Type) -> Config) { - self.init(configuration(Config.self)) + public init(_ configuration: (Config) -> Config) { + self.init(configuration(Config())) } /// Instantiates a new object with specified configuration diff --git a/Sources/FunctionalConfigurator/CustomConfigurable.swift b/Sources/FunctionalConfigurator/CustomConfigurable.swift index 6f87cbf..82b9832 100644 --- a/Sources/FunctionalConfigurator/CustomConfigurable.swift +++ b/Sources/FunctionalConfigurator/CustomConfigurable.swift @@ -5,8 +5,8 @@ public protocol CustomConfigurable {} extension CustomConfigurable { public typealias Config = Configurator - public func configured(using configuration: (Config.Type) -> Config) -> Self { - configured(using: configuration(Config.self)) + public func configured(using configuration: (Config) -> Config) -> Self { + configured(using: configuration(Config())) } public func configured(using configurator: Config) -> Self { @@ -15,8 +15,8 @@ extension CustomConfigurable { } extension CustomConfigurable where Self: AnyObject { - public func configure(using configuration: (Config.Type) -> Config) { - configure(using: configuration(Config.self)) + public func configure(using configuration: (Config) -> Config) { + configure(using: configuration(Config())) } public func configure(using configurator: Config) {