Rob Amos (Bok)

@bok
226 Followers
138 Following
1.4K Posts
iOS/macOS software engineer. Cloud Engima. F1 fan. Volunteer (@melbourne, @awsmelb). Many other things.
LocationMelbourne. Australia
@tonyarnold ... are you watching me on camera!?
@jinahadam I've been making apps for foldable devices for more than a decade now. 💻
@tcn33 that's a great idea!
@decryption at least you're not yet at the flashing with custom firmware stage yet that I got to with some of the Bunnings Grid devices.
@tonyarnold @layoutSubviews @PeteGoldsmith please don't talk about my future without me.

@mbrandonw @mattiem @adamz happy to be corrected if I'm reading it wrong, but the error messaging says it itself: that global dependencies can only be prepared once and are cached for the lifetime of that execution https://github.com/pointfreeco/swift-dependencies/blob/e49707527c892d18f041b4ae639a68b3d33dd7e8/Sources/Dependencies/DependencyValues.swift#L343

So it's statically frozen in the cache, making it a singleton. Sure, the convenience of being able to intercept access to the singleton and return a local value instead makes it a good utility but hiding the singleton doesn't mean the singleton doesn't exist.

swift-dependencies/Sources/Dependencies/DependencyValues.swift at e49707527c892d18f041b4ae639a68b3d33dd7e8 · pointfreeco/swift-dependencies

A dependency management library inspired by SwiftUI's "environment." - pointfreeco/swift-dependencies

GitHub

@mattiem @adamz for those that don't know what they're doing, it's a singleton.

For those that do know what they're doing, it's a pain point.

@mattcomi I use Claude Code to track whisky tastings. I strongly recommend this.
@mattiem @adamz I have long been of this opinion. I think it's a great starting point if you're new to Swift development. I do not think it (or the ecosystem in general) is something I'd reach for if I'm starting a new project.
@decryption what if the hyperlink is to goatse?