Post

Replies

Boosts

Views

Activity

Reply to SwiftUI TextField with optional value working for @State but not @Binding properties
Have a look here: https://www.appypievibe.ai/blog/working-with-binding-in-swiftui#:~:text=In%20SwiftUI%2C%20you%20can%20create,and%20also%20stores%20its%20value or here: https://stackoverflow.com/questions/59247183/swiftui-state-vs-binding Binding does not cause the View to update the body, which State does. So, it's normal it is nor updated. You can see that boundValue is not updated by adding onSubmit: TextField("Bound value", value: $boundValue, format: .number) .onSubmit { print("Textfield submitted", boundValue) }
Topic: UI Frameworks SubTopic: SwiftUI
Aug ’25
Reply to SwiftUI TextField with optional value working for @State but not @Binding properties
May be I missed something of your intent. Why using a Binding here ? That means ContentView is called from another view with a Sate var ? Otherwise, it is a misuse of Binding. I changed to this, which works. struct ContentView: View { @State var boundValue: Double? @State private var stateValue: Double? = 55 var body: some View { CallTextField(boundValue: $boundValue) // TextField("Bound value", value: $boundValue, format: .number) Text("\(boundValue ?? .nan)") TextField("State value", value: $stateValue, format: .number) Text("\(stateValue ?? .nan)") } } struct CallTextField: View { @Binding var boundValue: Double? var body: some View { TextField("Bound value", value: $boundValue, format: .number) } }
Topic: UI Frameworks SubTopic: SwiftUI
Aug ’25
Reply to Bottom Tile Icon Text
Welcome to the forum.   bottom navigation tile when it cannot be localized Why can't it be localized ? Could you give more details as well as screenshot ?   Will the app be acceptable from a publishing point of view? Do you mean Appstore review point of view ? I do not see any reason here for rejection.
Aug ’25
Reply to Xcode 26 SDK/Simulator Download Issue: (-67061 invalid signature (code or signature have been modified)
I've noticed a point when installing ß7. When I installed ß6 and was asked to download iOS, WatchOS… simulators. Which I did. I kept ß6 installed and downloaded ß7 I was not asked to download simulators they are available in ß7 Does it give a hint to a workaround ? Even though I noticed you had the problem with ß6. uninstall ß7 download and install ß6: are you asked to download simulators ? install ß7. In anycase you should contact support and file a bug report.
Aug ’25
Reply to Clarification on the purpose of return value in textFieldShouldReturn
You should find a lot of information in this (old) post. https://stackoverflow.com/questions/33624413/why-textfieldshouldreturn-is-still-working-when-i-return-false The return value from textFieldShouldReturn answers a different question. If the text field has an action for the control event editingDidEndOnExit, that will cause the keyboard to dismiss unless textFieldShouldReturn is implemented to return false.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to How to disable textfield without making it grayed out?
like having .disabled without graying it out? That would be confusing for the user. It is very important to have a consistent. I tried something. Let me know if that's what you are looking for: struct ContentView: View { @State private var theField: String = "" @State private var disabledField = true @State private var prompt: String = "disabled" @FocusState private var focusedField: Int? var body: some View { TextField(prompt, text: $theField) .frame(width: 200, height: 30) .disabled(disabledField) .focused($focusedField, equals: 1) .overlay( // so the doubletap will be handled, even though textFied is disabled RoundedRectangle(cornerRadius: 4) .stroke(Color.gray, lineWidth: 1) // just to see, color can be set to bg or white .offset(x: -5, y: 0) .onTapGesture(count: 2) { prompt = "Enter" disabledField = false focusedField = 2 // any value ≠ 1: to get the cursor appear when set to 1 DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) { // delay to sequence focus changes and get cursor appear focusedField = 1 } } ) } } You can set the color of the prompt so that it does not appear dimmed TextField(prompt, text: $theField, prompt: Text(prompt).foregroundColor(.blue))
Topic: UI Frameworks SubTopic: SwiftUI
Aug ’25
Reply to Sensitive language ?
I found similar issues in the forum. Spam or abusive language detection is really loosely focused to says the least. for instance a post with F r e e word (to say for instance that Apple's tutorial are) has rejected. I have found 3 options, if you are confident there is no offensive language in your post: write the post, capture image, and attach image instead of text. Split your text until you find offending word (tedious) file a bug report
Topic: Community SubTopic: Apple Developers Tags:
Aug ’25