Dependency

1.0.0

A dependency Injection solution for SwiftUI. Thank you Antoine van der Lee and Vincent Pradeilles for initially showcasing this idea.
chFlorian/Dependency

What's New

v1.0.0

2021-11-15T13:05:22Z

Dependency

A dependency Injection solution for SwiftUI. Based on a video by Antoine Van Der Lee and Vincent Pradeilles.

Usage

private struct UserServiceKey: DependencyKey {
    static var currentValue: UserService = MyUserService()
}

extension DependencyValues {
    var userService: UserService {
        get { Self[UserServiceKey.self] }
        set { Self[UserServiceKey.self] = newValue }
    }
}

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Dec 21 2024 15:04:48 GMT-1000 (Hawaii-Aleutian Standard Time)