Post

Replies

Boosts

Views

Activity

Reply to Getting SwiftUI TextEditor's Selection Range
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()) } }) } }
Mar ’24
Reply to GOP is missing in result file using AVAssetWriter on macOS
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 :)
Sep ’21