Swift struct custom deinit

I think that you might want to look at the Array documentation Apple Developer Documentation and look for the bit about copy-on-write. Then isKnownUniquelyReferenced might be of interest How to safely use reference types inside value types with isKnownUniquelyReferenced() - free Swift 5.4 example code and tips

Chances are that, with all of that, you'll see that you can get most of what you're after. If not, could you clarify what smart pointers provide that you want available in swift?

1 Like