It's still using NSTextView inside. Here's a solution:
import SwiftUI
struct MyView: View {
@State var myString = "Hello world"
var body: some View {
TextEditor(text: $myString)
.onReceive(NotificationCenter.default.publisher(for: NSTextView.didChangeSelectionNotification), perform: { notification in
if let textView = notification.object as? NSTextView {
print(textView.selectedRange())
}
})
}
}
Post
Replies
Boosts
Views
Activity
Just want to add a comment that it wasn't a bug or inconsistency between platforms. Maybe AVAssetWriter works a little bit different on macOS side, but the problem was related to overwriting data in memory on macOS.
Looks like AVAssetWriter is caching data before actually writing it to disk and that data was incorrect already at that moment.
I used Feedback Assistant and Apple team found a bug in my code, they've suggested that I need to copy frame data before appending it.
Media Engineer thanks for your help :)
Still not working. Can't see my latest builds (one was published in Testflight 2.5 hours ago)