Post

Replies

Boosts

Views

Activity

Textfield binded string var not clearing when autocorrected
I have a simple text field and a button the textfield text var is binded to my @state string var $strText. the button has an action that sets strText = "" when trying to input "nintendo switch" without a capital N, the textField will auto correct to "Nintendo switch". When pressing the button, the textfield will not clear. I have tried wrapping the button action in a DispatchQueue.main.async but there is no change in behavior. However, adding an .onSubmit{ } view modifier to the text field and calling strText = "" in the onSubmit closure will clear the textField. Is there anyway to have the button action call the textfield's submit trigger? import SwiftUI struct ContentView: View { @State var text: String = "" private func clearText() { print("YAHOOOO 2clear \(self.text)") self.text = "" print("YAHOOOO 2\(self.text)") } var body: some View { VStack { TextField("Message", text: $text, axis: .vertical) .autocorrectionDisabled(false) .onSubmit { clearText() } Button(action: { DispatchQueue.main.async { clearText() } }, label: { Text("Send") }) } .padding() } }
0
0
99
1w
AVMutableMetaDataItem cannot assign to value
Hello I am trying to assign some metadata to my AVExportSession so that the output files have the same metadata attached as the AVExportSession. I have tried import AVFoundation import AVKit and a combo of the two. The AVMutableMetaDataItem.value is unable to be set because the compiler will reference NSObject.value property or its NSObject.setValue(forKey:) method I have tried creating a playground and just creating the Mutable Metadata item without the same errors When trying to subclass AVMutableMetaDataItem and trying to override its open var value property, the compiler will then complain the value we are overriding is read-only in reference to its non-mutable counterpart AVMetaDataItem.value Does a radar need to be filled or is there something I am not doing correctly with creating an AVMutableMetaDataItem?
2
0
595
Aug ’23