wip
This commit is contained in:
parent
93c5c959ff
commit
8c091d3d69
|
@ -196,20 +196,25 @@ struct NavigationShowcase: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
struct ViewControllerShowcase: View {
|
struct ViewControllerShowcase: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
VStack {
|
VStack {
|
||||||
Text("Customized")
|
Text(".introspect(.view, ...)")
|
||||||
|
.lineLimit(1)
|
||||||
|
.minimumScaleFactor(0.5)
|
||||||
|
.padding(.horizontal, 12)
|
||||||
|
.font(.system(.subheadline, design: .monospaced))
|
||||||
}
|
}
|
||||||
#if os(iOS) || os(tvOS)
|
}
|
||||||
.introspect(.view, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { viewController in
|
.navigationViewStyle(.stack)
|
||||||
viewController.view.backgroundColor = .cyan
|
.introspect(.view, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { viewController in
|
||||||
}
|
viewController.children.first?.view.backgroundColor = .cyan
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct SimpleElementsShowcase: View {
|
struct SimpleElementsShowcase: View {
|
||||||
|
|
||||||
|
@ -223,71 +228,119 @@ struct SimpleElementsShowcase: View {
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
TextField("Text Field Red", text: $textFieldValue)
|
TextField("Text Field Red", text: $textFieldValue)
|
||||||
// .introspectTextField { textField in
|
#if os(iOS) || os(tvOS)
|
||||||
// textField.layer.backgroundColor = UIColor.red.cgColor
|
.introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { textField in
|
||||||
// }
|
textField.backgroundColor = .red
|
||||||
// .background(Color.red)
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13)) { textField in
|
||||||
|
textField.backgroundColor = .red
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TextField("Text Field Green", text: $textFieldValue)
|
TextField("Text Field Green", text: $textFieldValue)
|
||||||
.cornerRadius(8)
|
.cornerRadius(8)
|
||||||
// .introspectTextField(observe: ) { textField in
|
#if os(iOS) || os(tvOS)
|
||||||
// textField.layer.backgroundColor = UIColor.green.cgColor
|
.introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { textField in
|
||||||
// }
|
textField.backgroundColor = .green
|
||||||
// .background(Color.green)
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13)) { textField in
|
||||||
|
textField.backgroundColor = .green
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Toggle("Toggle Red", isOn: $toggleValue)
|
Toggle("Toggle Red", isOn: $toggleValue)
|
||||||
#if !os(tvOS)
|
#if os(iOS)
|
||||||
// .introspectSwitch { uiSwitch in
|
.introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16)) { toggle in
|
||||||
// uiSwitch.layer.backgroundColor = UIColor.red.cgColor
|
toggle.backgroundColor = .red
|
||||||
// }
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13)) { toggle in
|
||||||
|
toggle.layer?.backgroundColor = NSColor.red.cgColor
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Toggle("Toggle Green", isOn: $toggleValue)
|
Toggle("Toggle Green", isOn: $toggleValue)
|
||||||
#if !os(tvOS)
|
#if os(iOS)
|
||||||
// .introspectSwitch { uiSwitch in
|
.introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16)) { toggle in
|
||||||
// uiSwitch.layer.backgroundColor = UIColor.green.cgColor
|
toggle.backgroundColor = .green
|
||||||
// }
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13)) { toggle in
|
||||||
|
toggle.layer?.backgroundColor = NSColor.green.cgColor
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
HStack {
|
HStack {
|
||||||
Slider(value: $sliderValue, in: 0...100)
|
Slider(value: $sliderValue, in: 0...100)
|
||||||
// .introspectSlider { slider in
|
#if os(iOS)
|
||||||
// slider.layer.backgroundColor = UIColor.red.cgColor
|
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16)) { slider in
|
||||||
// }
|
slider.backgroundColor = .red
|
||||||
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13)) { slider in
|
||||||
|
slider.layer?.backgroundColor = NSColor.red.cgColor
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Slider(value: $sliderValue, in: 0...100)
|
Slider(value: $sliderValue, in: 0...100)
|
||||||
// .introspectSlider { slider in
|
#if os(iOS)
|
||||||
// slider.layer.backgroundColor = UIColor.green.cgColor
|
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16)) { slider in
|
||||||
// }
|
slider.backgroundColor = .green
|
||||||
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13)) { slider in
|
||||||
|
slider.layer?.backgroundColor = NSColor.green.cgColor
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Stepper(onIncrement: {}, onDecrement: {}) {
|
Stepper(onIncrement: {}, onDecrement: {}) {
|
||||||
Text("Stepper Red")
|
Text("Stepper Red")
|
||||||
}
|
}
|
||||||
// .introspectStepper { stepper in
|
#if os(iOS)
|
||||||
// stepper.layer.backgroundColor = UIColor.red.cgColor
|
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16)) { stepper in
|
||||||
// }
|
stepper.backgroundColor = .red
|
||||||
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13)) { stepper in
|
||||||
|
stepper.layer?.backgroundColor = NSColor.red.cgColor
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Stepper(onIncrement: {}, onDecrement: {}) {
|
Stepper(onIncrement: {}, onDecrement: {}) {
|
||||||
Text("Stepper Green")
|
Text("Stepper Green")
|
||||||
}
|
}
|
||||||
// .introspectStepper { stepper in
|
#if os(iOS)
|
||||||
// stepper.layer.backgroundColor = UIColor.green.cgColor
|
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16)) { stepper in
|
||||||
// }
|
stepper.backgroundColor = .green
|
||||||
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13)) { stepper in
|
||||||
|
stepper.layer?.backgroundColor = NSColor.green.cgColor
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
DatePicker(selection: $datePickerValue) {
|
DatePicker(selection: $datePickerValue) {
|
||||||
Text("DatePicker Red")
|
Text("DatePicker Red")
|
||||||
}
|
}
|
||||||
// .introspectDatePicker { datePicker in
|
#if os(iOS)
|
||||||
// datePicker.layer.backgroundColor = UIColor.red.cgColor
|
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16)) { datePicker in
|
||||||
// }
|
datePicker.backgroundColor = .red
|
||||||
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13)) { datePicker in
|
||||||
|
datePicker.layer?.backgroundColor = NSColor.red.cgColor
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -298,9 +351,15 @@ struct SimpleElementsShowcase: View {
|
||||||
Text("Option 3").tag(2)
|
Text("Option 3").tag(2)
|
||||||
}
|
}
|
||||||
.pickerStyle(SegmentedPickerStyle())
|
.pickerStyle(SegmentedPickerStyle())
|
||||||
// .introspectSegmentedControl { segmentedControl in
|
#if os(iOS) || os(tvOS)
|
||||||
// segmentedControl.layer.backgroundColor = UIColor.red.cgColor
|
.introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { datePicker in
|
||||||
// }
|
datePicker.backgroundColor = .red
|
||||||
|
}
|
||||||
|
#elseif os(macOS)
|
||||||
|
.introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13)) { datePicker in
|
||||||
|
datePicker.layer?.backgroundColor = NSColor.red.cgColor
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,6 +368,6 @@ struct SimpleElementsShowcase: View {
|
||||||
|
|
||||||
struct ContentView_Previews: PreviewProvider {
|
struct ContentView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ContentView(selection: 1)
|
ContentView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,11 +162,6 @@ final class IntrospectionPlatformViewController: PlatformViewController {
|
||||||
handler?()
|
handler?()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLayout() {
|
|
||||||
super.viewDidLayout()
|
|
||||||
handler?()
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidAppear() {
|
override func viewDidAppear() {
|
||||||
super.viewDidAppear()
|
super.viewDidAppear()
|
||||||
handler?()
|
handler?()
|
||||||
|
|
Loading…
Reference in New Issue