Post

Replies

Boosts

Views

Activity

Reply to Calling a property of a struct with a placeholder?
IBAction with switch statement (scaleIndex is the same as sender.tag, so the user selects the scale (basic, rhythm, suppleness)) 				switch scaleIndex { 				case 0: 						currentTraining = \.basicTraining 				case 1: 						currentTraining = \.rhythm 				case 2: 						currentTraining = \.suppleness but this doesn't work What do you mean "doesn't work" ? What do you get ? A compiler error ? A crash ? Could you show the complete code, with definition of all types, so that we can test ?
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’21
Reply to Calling a property of a struct with a placeholder?
It seems skillIndex never changes, is always 0. Is that the case ? Once you have changed currentTraining, where do you expect something to change ? Where do you notice it didn't change ? trainHorse() has a UIButton parameter. But it is not declared as an IBAction. Where do you call it ? So we still miss a lot of information to find where are the flaws in your code.
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’21
Reply to Calling a property of a struct with a placeholder?
@imey All I need to know is how to change the var currentTraining The way you do it in @IBAction func scalesButton switch seems correct. So the problem is elsewhere. Could be: the @IBAction func scalesButton is not called. => check by adding a print at the beginning of the func. once you have updated, you don't reset the relevant fields with the new value => where do you use the new value of currentTraining once updated ? We don't see it in the published code
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’21
Reply to Is it possible to prompt user to enter 'do not disturb' mode from my app?
IMHO, that would be surprising as it would allow an app to change an important user setting, hiding user from important notifications. Even after prompting the user ; in fact, if it is possible with a prompt, that would be possible automatically (unless Apple creates a plist setting to allow to request it…). It is the same philosophy with any change of setting that may change iPhone capability at the detriment of user of other apps. So, I do doubt it will ever be possible "legally" anytime in the future.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’21
Reply to Parsing JSON GET response with special characters
Could having non-matching data types make the JSON parsing fail? (i.e. my struct defining a string when the JSON response is a bool?) Yes, decode will fail. Could you show the complete JSON you have with print of line 16 ? may read this to see various ways to handle missing data (notably making properties optional) https://stackoverflow.com/questions/46344963/swift-jsondecode-decoding-arrays-fails-if-single-element-decoding-fails
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’21
Reply to Calling a property of a struct with a placeholder?
I don't think it can work in the trainHorse function after all, but there is still hope for the progress bar. This is updated every time the trainHorse button is pressed. skillProgress.progress = myHorses[horseIndex][keyPath: currentTraining] skillOutlet.text = "\(currentScaleName): \(myHorses[horseIndex][keyPath: currentTraining])"   } The scalesButton updates the currentTraining var, then the trainHorse button updates skillProgress So, where is this code ? In which function now ? Where is this func called. It is nearly impossible to understand what you do if you keep providing such partial information.
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’21
Reply to Issue of navigationBarHidden
Could you show the code with all the places where you apply navigationBarHidden() modifier. How you apply it is critical: https://stackoverflow.com/questions/59027529/swiftui-navigation-bar-hide-is-not-working Note: you tagged as Swift. It is purely a SwiftUI question.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’21
Reply to Apple developer account - duplication.
You need to explain very clearly in the notes for reviewer what you did and why it is not a duplicate (they would probably call it a spam). You need also to justify that you own the 2 accounts. If you are very clear and transparent to them, there should not be an issue. Just bring material that demonstrate all your claims. Note that it is not a Swift question, you should not have tagged is as Swift.
Jan ’21
Reply to Handling User Interaction
There is a WKCrownSequencer that allows to track rotation of the digital crown. But, AFAIK, it does not allow to intercept the click. The reason is probably that click is used by system to detect you want to leave the app and that behaviour should remain consistent.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’21