ivlevAstef / DITranquillity

Dependency injection for iOS (Swift)
MIT License
421 stars 32 forks source link

Custom/User scope #135

Closed ivlevAstef closed 5 years ago

ivlevAstef commented 5 years ago

Now library has 5/7 scopes: single, perRun(weak/strong), perContainer(weak/strong), objectGraph, prototype. But if need clean scope data, user can't do that. Need user scopes:

extension DILifetime
{
   static let userScope = DIScope(.weak()/.strong(), name: "your scope") // Or your can inheritance
}

and remake current storage implementation. Weak/Strong - it's not enum, it's storage rule.

Scope has method:

fetch(_ maker: () -> T) -> T
ivlevAstef commented 5 years ago

into 3.6.0