4 ms·
The articles says it's used mostly in old UI components like NSCell, that can only be used on the main thread. NSImage & NSImageRep have questionable thread saf
by galad87 2y ago
The articles says it's used mostly in old UI components like NSCell, that can only be used on the main thread.
NSImage & NSImageRep have questionable thread safety, and I don't know how often NSAnimation is copied on a non main thread.
- isodev 2y agoAnd is SwiftUI's @MainActor annotation "main thread" enough for this? e.g. if a View with @MainActor annotation renders a child which is a NSCell/NSImage/NSImageRep/NSAnimation wrapped in a representable - all is good? I don't know why Apple keeps adding things to Swift without removing the old things.
- klausa 2y agoFor two main reasons: a) because there are untold amount of apps relying on the old things b) because the people working on the language are not the same people working on the frameworks.
- isodev 2y agoSo we just have to live with every mistake and “mood” Apple has dropped into Swift, accumulating complexities and “time to ponder what I’m doing wrong” while debugging?
- favorited 2y agoNSCopyObject isn't something that was "dropped into Swift," it's a function that has existed since the mid 90s, and is available in Swift because Swift can call C and Objective-C functions. But yes, you do have to live with the history of the platform you're developing for. Opportunities to break backwards-compatibility are few and far-between, because users don't like when OS updates make their apps stop working.