Skip to content

Commit

Permalink
fix(Configurator): Config initializable autocompletion is now available
Browse files Browse the repository at this point in the history
  • Loading branch information
maximkrouk committed Oct 17, 2020
1 parent 19a41dc commit 1f90ff1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Sources/FunctionalConfigurator/ConfigIntializable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Sources/FunctionalConfigurator/CustomConfigurable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ public protocol CustomConfigurable {}
extension CustomConfigurable {
public typealias Config = Configurator<Self>

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 {
Expand All @@ -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) {
Expand Down

0 comments on commit 1f90ff1

Please sign in to comment.