Just released a brand new collection type on GitHub with a native Swift wrapper you might like 😎 github.com/intuit/Grouped
Conversation
Cool! Why a reference type instead of a value type?
1
It made more sense that way to be able to mirror the underlying ObjC structure. Do you see a meaningful diff. as a class?
2
Value semantics are enormously different (cf my objc.io article). You do have the tools.
2
how do you solve the issue of hoisting "unshare()" calls out of loops, etc? Doesn't that required compiler support?
1
Not sure why you need to hoist unshare out of loops if you avoid making a copy of the internal reference until value is mutated
2
but that would be a restriction that would have to be imposed on end users - easy to unknowingly do that sort of thing.
1
Same semantics as Array. Do you think Array is problematic too?
1
is that true? I was told that the Swift compiler optimizes this sort of thing so it's not an issue.
1
Replying to
Huh. Guess I'm not sure what exactly it's optimizing.
Replying to
from my understanding, it was hoisting unshare() calls out of loops when assigning an Array to another variable and mutating
2
…preventing multiple unnecessary copies of backing store in heap. Would love to understand this better myself!

