Hi, I've recently open sourced a dependency injection framework for Swift called Cleanse. https://github.com/square/cleanse
It does a couple things I'd consider novel with the type system to make wiring up functions easy without having to use reflection or other runtime or compile-time hacks (I tried elaborating on it in this part of the README here https://github.com/square/Cleanse#dependency-requesting-terminating-methods) Anyways, I'm looking for feedback on the design and use of this library, and maybe strike up a discussion on language features that may make writing a library such as this be able to be "cleaner" in the future. Couple things that come to mind are custom annotations for qualifying types (instead of what we call "type tags"), variadic generic arguments (which we work around by code generating the various arities), or even a plugin architecture to achieve things similar to what can be done with Java annotation processors. I'd also be interested in feedback on some more of the implementation details. e.g. is using this to key objects by type a good thing or a terrible thing? https://github.com/square/Cleanse/blob/master/Cleanse/TypeKeyProtocol.swift Since Swift generics don't seem to be completely understood by the general population, was hoping I could get some concrete feedback here. Even would be stoked with a response to the tune of "You don't need DI in Swift for reasons X, Y, and Z." Thanks! Mike Lewis
_______________________________________________ swift-users mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-users
