MyApp/RetroClipScopeControl.swift
803 B · 22 lines · swift · Download from the repository page
import SwiftUI struct RetroClipScopeControl: View { @Binding var selection: ClipScope var body: some View { ViewThatFits(in: .horizontal) { HStack(spacing: 12) { choices } VStack(alignment: .leading, spacing: 12) { choices } } } @ViewBuilder private var choices: some View { ForEach(ClipScope.allCases) { scope in Button { selection = scope } label: { Label(scope.rawValue, systemImage: selection == scope ? "checkmark.square.fill" : "square") .frame(maxWidth: .infinity) } .buttonStyle(RetroButtonStyle(color: selection == scope ? RetroTheme.yellow : RetroTheme.surface)) .accessibilityAddTraits(selection == scope ? .isSelected : []) } }}