Post

Replies

Boosts

Views

Activity

Reply to Why is my List elements are deleted if I ON/OFF darkmode.
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).
Mar ’23
Reply to How to remove space occupied by text's on swiftui
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() } }
Mar ’23