VisibilityTapper.swift 590 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // VisibilityTapper.swift
  3. // Todos
  4. //
  5. // Created by Sam Jaffe on 2/28/26.
  6. //
  7. import SwiftUI
  8. struct ShowHideTapper: View {
  9. @Binding var shown: Bool
  10. @Binding var hideToggle: Bool
  11. var body: some View {
  12. Label("", systemImage: hideToggle ? "eye.slash" : "eye")
  13. .onTapGesture {
  14. hideToggle = !hideToggle
  15. }
  16. .padding(.leading, -6.5)
  17. .padding(.trailing, -6.5)
  18. .help("Toggle visibility")
  19. }
  20. }
  21. #Preview {
  22. @Previewable @State var shown = false
  23. @Previewable @State var hidden = false
  24. ShowHideTapper(shown: $shown, hideToggle: $hidden)
  25. }