swift-service-lifecycle icon indicating copy to clipboard operation
swift-service-lifecycle copied to clipboard

fix ambiguous use of init

Open tib opened this issue 1 year ago • 1 comments

The following code snippet emits an 'Ambigous use of init' error when using Swift Service Lifecycle v2.3.0:

let config = ServiceGroupConfiguration(
    services: [],
    logger: logger
)

This problem can be hotfixed like this, but it's not the right way:

let services: [ServiceGroupConfiguration.ServiceConfiguration] = []
let config = ServiceGroupConfiguration(
    services: services,
    logger: logger
)

This PR aims to fix the underlying issue in the library itself by removing the unnecessary init method, that caused the compiler error.

tib avatar Feb 11 '24 12:02 tib

Ah that's an unfortunate unambiguity but the proposed change here would be breaking API. In hindsight we should have made the parameter serviceConfigurations and services for the other one. What we could do is a deprecation dance but I am unsure if that's worth it. How many people are actually passing an empty array to a ServiceGroup?

FranzBusch avatar Feb 12 '24 10:02 FranzBusch