StatusPicker.swift 677 B

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // StatusPicker.swift
  3. // Todos
  4. //
  5. // Created by Sam Jaffe on 3/7/26.
  6. //
  7. import SwiftUI
  8. struct StatusPicker: View {
  9. @Binding var status : Status
  10. var displayIcon : Bool = true
  11. var body: some View {
  12. HStack {
  13. if displayIcon {
  14. Image(systemName: status.label)
  15. .frame(width: 20)
  16. .padding(.trailing, -10)
  17. }
  18. Picker("", selection: $status) {
  19. ForEach(Status.allCases) { unit in
  20. Text(unit.description).tag(unit)
  21. }
  22. }
  23. .fixedSize(horizontal: true, vertical: false)
  24. }
  25. }
  26. }
  27. #Preview {
  28. @Previewable @State var status = Status.todo
  29. StatusPicker(status: $status, displayIcon: true)
  30. }