Hello,
I have an idea for a Toggle Button Tray.
For now, to add a button to active / deactivate a feature we go with a @State variable and a toggle code.
Maybe it is worth creating a specific Toggle button with a binding to a State variable.
Actual
@State private var displayOnlyFavorite = false
let favoriteItem = BDButtonTrayItem(title: "Favorite", systemImage: "star") { item in
item.systemImage = self.displayOnlyFavorite ? "star" : "star.fill"
self.displayOnlyFavorite.toggle()
self.reloadLocations()
}
favoriteItem.activeColor = Color.yellow
favoriteItem.inactiveColor = Color.yellow
Idea
@State private var displayOnlyFavorite = false
let favoriteItem = BDButtonTrayToggleItem(title: "Favorite", systemImage: "star", systemImageToggled: "star.fill", toggle: $displayOnlyFavorite) { item in
self.reloadLocations()
}
Nicolas
Hello,
I have an idea for a Toggle Button Tray.
For now, to add a button to active / deactivate a feature we go with a @State variable and a toggle code.
Maybe it is worth creating a specific Toggle button with a binding to a State variable.
Actual
Idea
Nicolas