Skip to content

[Idea] - Toggle Button Tray #5

Description

@satan87

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions