Cleanse
Cleanse copied to clipboard
API Facelift
The public interface for Cleanse was inspired by Java's Guice and feels a bit outdated and less idiomatic. This has created some friction for other considering using Cleanse as a DI solution. I'd like to facelift the API using some of the modern language features (i.e result builders). Put together a functional POC: https://github.com/sebastianv1/SwiftInjector
static func configure(binder: Binder<Unscoped>) {
binder.bind(SomeType.self).to { (depA: A) in
return SomeType(depA: depA)
}
}
becomes -->
static var binding: some SwiftInjector.Binding {
Group {
Bind(SomeType.self) { (depA: DepA)
SomeType(depA: DepA)
}
}
}
Any interest to iterate on the API together @jbeachwood or @chrissonoda ? Would include interop with the old API to support easy migrations.
(And @brianwang9100 )