tgrapperon / swift-dependencies-additions

More dependencies for `swift-dependencies`
MIT License
298 stars 39 forks source link

Expose NotificationCenter.Dependency.init publicly #66

Closed Czajnikowski closed 1 year ago

Czajnikowski commented 1 year ago

I think it's not very useful without the init that allows injection of members... For example, I'm trying to adjust it in tests so whenever I post some notification I expect something specific to happen.

tgrapperon commented 1 year ago

Hey @Czajnikowski! Thanks for the PR. In my mind, I was expecting folks to use the public init that expects a NotificationCenter. You can create your own local instances, and directly send notifications to them. You can even create subclasses if you want to inspect the endpoints directly. This should be more faithful than filing the closures. Do you have an example in mind where you would want more control than what a private notification center offers?

Czajnikowski commented 1 year ago

Mmmm, I see... I think you're right, ability to post on my own NotificationCenter should be good enough. Thanks for the clarification, closing the PR 🧹