-
-
Save sturdysturge/aa58c37633fa97d05d7460482b10fdc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import Introspect | |
| struct ContentView: View { | |
| @State var sliderValue = 0.0 | |
| @State var toggleValue = false | |
| @State var stepperValue = 0.0 | |
| @State var textViewValue = "" | |
| @State var colour = Color.clear | |
| @State var textFieldValue = "Text" | |
| @State var date = Date() | |
| let stuff = ["one", "two", "three"] | |
| var body: some View { | |
| VStack { | |
| Slider(value: $sliderValue, in: 0...1) | |
| .introspectSlider { slider in | |
| slider.minimumValueImage = UIImage(systemName: "pencil") | |
| slider.minimumValueImage = UIImage(systemName: "house") | |
| } | |
| Toggle(isOn: $toggleValue) { | |
| Text("Toggle") | |
| } | |
| .introspectSwitch { uiSwitch in | |
| uiSwitch.offImage = UIImage(systemName: "pencil") | |
| uiSwitch.onImage = UIImage(systemName: "house") | |
| } | |
| Stepper("Stepper: \(stepperValue)", value: $stepperValue, in: 0...10) | |
| .introspectStepper { stepper in | |
| stepper.wraps = true | |
| stepper.isContinuous = false | |
| } | |
| TextEditor(text: $textViewValue) | |
| .introspectTextView { textView in | |
| textView.isSelectable = false | |
| } | |
| ColorPicker("Colour", selection: $colour, supportsOpacity: false) | |
| .introspectColorWell { colorWell in | |
| colorWell.supportsAlpha = true | |
| } | |
| List(stuff, id: \.self) { thing in | |
| Text(thing) | |
| } | |
| .introspectTableView { tableView in | |
| tableView.setEditing(true, animated: true) | |
| } | |
| TextField("", text: $textFieldValue) | |
| .introspectTextField { textField in | |
| textField.clearButtonMode = .unlessEditing | |
| } | |
| DatePicker("Date", selection: $date) | |
| .introspectDatePicker{ datePicker in | |
| datePicker.minimumDate = .init(timeIntervalSince1970: 971992542) | |
| } | |
| ScrollView { | |
| ForEach(stuff, id: \.self) { thing in | |
| Text(thing) | |
| } | |
| } | |
| .introspectScrollView { scrollView in | |
| scrollView.bounces = false | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment