Got it, thanks for your reply.
Post
Replies
Boosts
Views
Activity
I'm sure there is a better solution for data binding, but this opportunity what I've found to share data (Swift UI v.1). Let me know if you need any more information about the code.
The AlarmModel hasn't changed from the previous post. The button is in my TopBarView, and thats just toggle the isDarkMode bool. Button looks like: Button(action: {self.isDarkMode.toggle()}) { //there is just an image }. So I'm almost certain the problem is because I initialize an AlarmModel in the HomeView. I did this because the HomeView calls the other Views (and passes the initialized variables to the called Views), this is the only way I could connect the List (and other bool variables).
Thanks, thats works! Extra question: how can I bind the selection variable to an other view in the easiest way? I have a button in the other view with which I want to delete the selected element.
Is there a better solution?
This is how I managed to solve the problem:
Group {
if isEditMode {
Text("The alarm will ring at")
.padding(.bottom, 10)
Text(TimeMH().ToString(minuteAngle, hourAngle))
.font(.system(size: 25))
.background(Rectangle()
.fill(Color(UIColor.lightGray))
.frame(width: 90, height: 40)
.cornerRadius(10)
.shadow(radius: 5))
} else {
EmptyView()
}
}
What do you think exactly? Sorry, but I'm a complete beginner. Why is your proposed solution better?
I see, thanks. Do u have any idea how can I solve this discontinuity problem? Maybe any alternative to the atan2 function?