Post

Replies

Boosts

Views

Activity

Reply to Changing a value with the stepper
but 1 is default so this seemed unnecessary. You may be mistaking something. If you want to use stepper correctly, you need to set value. My aim with the VC is to change the value of the ration array in the model, the VC only shows the number listed in the model Can't you see what is given to onValueChanged? Please try before saying something based on wrong assumptions.
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’21
Reply to 3 code errors
You should better keep your code properly indented. Cmd-A Ctrl-I That will reveal some simple mistakes. Value of type 'String' has no member 'frame' : line 174 Cannot infer contextual base in reference to member 'all': line 176 Your line 170...180 will look like this when extra whitespaces and newlines removed: Text(isDecrementOn ? "-10" : "+10".frame(width: 50).padding(.all) ) You write .frame(width: 50) immediately after a String literal "+10". You may want to add .frame to Text, not a String. Closure containing a declaration cannot be used with function builder 'ViewBuilder' : line 186 The line struct ContentView_Previews: PreviewProvider { needs to be placed outside of the definition of struct ContentView. Meaning you need to write it after the closing brace } matching the opening brace struct ContentView: View {. You are writing struct ContentView_Previews: PreviewProvider { just after the closing brace for HStack(alignment: .center, spacing: 10) {. You need to be careful enough about matching parentheses.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21
Reply to Need suggestions on publisher autosave solutions
It should save as soon as anything changes, that is autosave I meant. Thanks. Then this description I tried to add a onChange modifier to the TextEditor but it applies as soon as any change happens, which is not desired. is sort of a mistake, OK? applies as soon as any change happens is the desired behavior.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21
Reply to Need suggestions on publisher autosave solutions
I should have put more context here. Please clarify: applies as soon as any change happens is the desired behavior but with using onChange, you find some undesired behavior Is that OK? You should better show all the view hierarchy and all the definitions of relevant types (Notes, SingleNote, or there may be more) to examine what is happening.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21