AliSoftware / Dip

Simple Swift Dependency container. Use protocols to resolve your dependencies and avoid singletons / sharedInstances!
MIT License
978 stars 75 forks source link

Property wrappers #225

Closed ilyapuchka closed 4 years ago

ilyapuchka commented 5 years ago

By adding @propertyDelegate to our existing auto-injection wrappers instead of

let client = Injected<Client>()

in Swift 5.1 we can write

@Injected var client: Client? = nil

~Note: as of Xcode 11 beta 1 () are needed after property delegate name~ ~UPD: Not an issue any more with refactoring of property wrappers into structs, but still requires initial nil value provided explicitly when using property wrapper (example updated) in class (not needed in structs)~

UPD: = nil is not needed any more

dchohfi commented 4 years ago

hey @ilyapuchka, thoughts on this? I might be able to pick it and see what is left