Hi! Currently I have two observable objects made in two different Swift Files.
File 1:
import Foundation
import SwiftUI
class ZonValueVariableVUUR: ObservableObject {
@Published var VUURZonValue = 0
}
File 2:
import Foundation
import SwiftUI
class MaanValueVariableVUUR: ObservableObject {
@Published var VUURMaanValue = 0
}
.
When I choose the option "Ram" in menu 1, the VUURZonValue will turn 18. I've done this with the code below that I added in the action-section of a button that's part of a menu.
ZonValueVUURFunc.VUURZonValue = 18
When I choose option "Leeuw" in menu 1, the VUURMaanValue will turn 15. I've done this the same way as above with the code below that I added in the action-section of a button that's part of a menu.
MaanValueVUURFunc.VUURMaanValue = 15
.
So to summarize, the VUURZonValue & VUURMaanValue are normally 0, but if you choose as user the option "Ram", VUURZonValue will change to 18, and if you choose "Leeuw" at VUURMaanValue the 0 will change in to 15.
So what do I do now to count the VUURZonValue and VUURMaanValue together and display this as text that get's updated if there is a change?
Topic:
Programming Languages
SubTopic:
Swift
Tags: