dimillian, 5 months ago I have only one item on my wishlist for Swift/SwiftUI. Please move the environment pattern from #SwiftUI to #Swift and let us access our environments from anywhere in Swift.
I have only one item on my wishlist for Swift/SwiftUI.
Please move the environment pattern from #SwiftUI to #Swift and let us access our environments from anywhere in Swift.
ristkof, 5 months ago @dimillian oh noes. Dependency injection without declaration is not a pattern I look forward to seeing often. Swift is meant to be safe, and Environment is a source for runtime errors.
@dimillian oh noes. Dependency injection without declaration is not a pattern I look forward to seeing often. Swift is meant to be safe, and Environment is a source for runtime errors.
dimillian, 5 months ago @ristkof it’s not IMO. It's a runtime error telling the developer did something wrong. It's very stable now. I would not do a SwiftUI app without it.
@ristkof it’s not IMO. It's a runtime error telling the developer did something wrong. It's very stable now. I would not do a SwiftUI app without it.
Arcticulate, 5 months ago @dimillian What about PreferenceKey? If not, maybe I misunderstood the use case.
@dimillian What about PreferenceKey? If not, maybe I misunderstood the use case.
dimillian, 5 months ago @Arcticulate still something only reachable at the view level.
@Arcticulate still something only reachable at the view level.
jasonhowlin, 5 months ago @dimillian it was interesting to see UITraitCollection adopted something like this.
@dimillian it was interesting to see UITraitCollection adopted something like this.
dasdom, 5 months ago @dimillian Swift already has globals. No need for branched globals. ;)
@dimillian Swift already has globals. No need for branched globals. ;)
dimillian, 5 months ago @dasdom To me it's not the same. Global is global. Environments are scoped. You can inject them in a hierarchy and have multiple versions of them.
@dasdom To me it's not the same. Global is global. Environments are scoped. You can inject them in a hierarchy and have multiple versions of them.
dasdom, 5 months ago @dimillian This is what I mean with "branched globals".
@dimillian This is what I mean with "branched globals".
dimillian, 5 months ago @dasdom So need for branched globals :p
@dasdom So need for branched globals :p
mikesax, 5 months ago @dimillian Sometimes I think of environment variables as glorified global variables. But yes! 💯
@dimillian Sometimes I think of environment variables as glorified global variables. But yes! 💯
dimillian, 5 months ago @mikesax Not exactly the same to me. Env are scoped to a hierarchy. Obviously we need to define what a hierarchy is outside of the view level.
@mikesax Not exactly the same to me. Env are scoped to a hierarchy. Obviously we need to define what a hierarchy is outside of the view level.
Add comment