4 ms·
That's not a bug. Your array reference isn't changing, just the data in the object. Scala (which uses var and val for mutable and immutable) would do exactly th
by ecopoesis 11y ago
That's not a bug. Your array reference isn't changing, just the data in the object. Scala (which uses var and val for mutable and immutable) would do exactly the same thing.
Heck, even Java (using final to mark immutable) would work like this. This is basically how every OO language works.
- myko 11y agoI think the poster understands that, it's just in Swift if you assign a Swift Array (not an NSArray) using let it is immutable both in reference and in whether or not items can be added or removed from it. That said, it's a quirk of the interop and I don't think Apple should spend time fixing it - rather developers should avoid NSArray within Swift.
- seivan 11y agoCan't avoid it for everything which is why I'm considering wrapping.