Post

Replies

Boosts

Views

Activity

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
Reply to 500 Error
😉 Hello Houston, we have a problem 😉 Do you know you can edit your post in the first hour after publication and change everything, including title. You cannot suppress it but editing is usually enough. Have a good day.
Aug ’25
Reply to Seeing some behaviour in Swift that I don't understand...
This suggests to me that my Sunday and Monday static instances are being passed by reference No, that's not the problem. But this way of adding a new trigger is causing the problem. fetchTriggers.append(Int.random(in: 1..<3) == 1 ? .sunMorning : .monEvening) This adds a new item. By it adds the same Sunday or Monday, with its existing ID. So, you reuse the same struct. Change to this to solve: Button("New Trigger") { let newTrigger = Int.random(in: 1..<3) == 1 ? FetchTrigger(dayOfWeek: .sunday, hour: 3) : FetchTrigger(dayOfWeek: .monday, hour: 6) fetchTriggers.append(newTrigger) // fetchTriggers.append(Int.random(in: 1..<3) == 1 ? .sunMorning : .monEvening) } You can also create a new ID: struct FetchTrigger: Identifiable { static var monEvening: FetchTrigger = .init(dayOfWeek: .monday, hour: 6) static var sunMorning: FetchTrigger = .init(dayOfWeek: .sunday, hour: 3) var id = UUID() // all need to be var mutating func changedId() -> FetchTrigger { self.id = UUID() return self } and call: fetchTriggers.append(Int.random(in: 1..<3) == 1 ? .sunMorning.changedId() : .monEvening.changedId())
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’25
Reply to Color folder and tags
For your needs may be… So you will not use tags anymore. But I just imagine the comments if tags had been suppressed. In addition you can have multiple tags, don't know if you can have multi colors.
Topic: Design SubTopic: General
Aug ’25
Reply to Learn to code / beginner
Welcome to the forum. A first comment: edit your text to make each question clear and post easier to read. And avoid asking so many questions on so different topics. Anyway, I'll try to provide some answers. Q1: How should I best start learning? For example, is Swift Playgrounds the right first step? My personal advice: start with tutorials from Apple like 'Develop in Swift fundamentals'. Or go and visit https://developer.apple.com/pathways/. If you want to learn SwiftUI, select it. Q2: How should I continue afterwards to gain further knowledge, possibly in areas like system architecture, cybersecurity, or cloud computing (even though I don’t want to commit too early to one direction)? You will find resources here again: https://developer.apple.com/pathways/. My advice to continue, after step 1, is to imagine and develop a complete (yet simple) app. That's how you will put what you learned in practice. And then, each time you fall on a problem, ask the forum for help. Q3: Can you recommend a learning schedule or intensity (e.g., how often per day or week I should practice) for someone who works full-time? It depends on the goals you have. But usually, when you learn developing, it is not uncommon to spend several hours some days. I would say, 10 hours a week to be a minimum. Q4: Is my current MacBook Air (2020, Intel i3, 8 GB RAM, 250 GB SSD) still suitable for learning and beginner development, or would you recommend upgrading to a newer model? Essentially, no, unless you just want to wet your feet. The storage (250 GB) will be insufficient. 500 GB or better 1TB is needed. Same for RAM, I would avise 16 GB at least. More critical, MacOS 26 (available as beta, to be released in a few weeks) will not run on Intel based machines. So it will be obsolete very rapidly. Q5: On top of that, my English is not perfect yet – is it possible to improve it alongside learning coding? That's a different question. To code, that's not a problem. But if you want to take profit of all existing resources (e.g., forum) that may be an issue, even though automatic translation is better everyday. Coding is not the best way to learn, because it is very limited in focus. Q6: I’m very motivated to finally start this journey, even though I once turned down an IBM apprenticeship when I was younger. That's a good condition, so good luck.
Aug ’25
Reply to Output is stuck on String
First a question. What do you mean with: xoutput: () = self.xaxis.text = String(data.acceleration.x) Which type do you expect for xoutput ? Secondly, you redeclare xoutput. that's an error. var xoutput = xoutput * 9.81 Why not simply: var output = String(data.acceleration.x * 9.81) An advice, seeing some of your posts. You should probably spend some time to learn Swift and app development from Apple's tutorials. For instance, Develop in Swift fundamentals (in Apple Library).
Aug ’25