Instance Method

state(_:)

Sets the checked/unchecked/mixed state

Declaration

func state(_ state: NSControl.StateValue) -> Self

Example


MenuItem("Show")
    .submenu {
        for filter in model.filters {
            MenuItem(filter.name)
              .onSelect { filter.isEnabled.toggle() }
              .checked(filter.isEnabled)
        }
    }
    .state(model.allFiltersEnabled
        ? .on
        : model.allFiltersDisabled ? .off : .mixed)

See Also

Appearance