TabBarController

This commit is contained in:
Lois Di Qual 2019-11-27 09:43:22 -08:00
parent ea9a33635d
commit 5034d7dab8
3 changed files with 12 additions and 8 deletions

View File

@ -27,7 +27,7 @@ public enum Introspect {
return nil
}
for subview in superview.subviews[entryIndex...superview.subviews.count - 1] {
for subview in superview.subviews[entryIndex..<superview.subviews.endIndex] {
if let typed = findChild(ofType: type, in: subview) {
return typed
}
@ -176,6 +176,13 @@ extension View {
))
}
public func introspectTabBarController(customize: @escaping (UITabBarController) -> ()) -> some View {
return background(IntrospectionViewController(
selector: { $0.tabBarController },
customize: customize
))
}
public func introspectTextField(customize: @escaping (UITextField) -> ()) -> some View {
return self.background(IntrospectionView(
selector: { introspectionView in

View File

@ -8,6 +8,9 @@ struct ContentView: View {
ListExample()
.tabItem { Text("List") }
.tag(0)
.introspectTabBarController { tabBarController in
tabBarController.tabBar.layer.backgroundColor = UIColor.green.cgColor
}
ScrollViewExample()
.tabItem { Text("ScrollView") }
.tag(1)

View File

@ -10,19 +10,13 @@ SwiftUI | UIKit | Introspect
List | UITableView | `.introspectTableView()` on a list child
ScrollView | UIScrollView | `.introspectScrollView()` on a scroll view child
NavigationView | UINavigationController | `.introspectNavigationController()` on a navigation child
TabbedView | UITabBarController | `.introspectTabBarController()` on a tab bar child
TextField | UITextField | `.introspectTextField()`
Toggle | UISwitch | `.introspectSwitch()`
Slider | UISlider | `.introspectSlider()`
Stepper | UIStepper | `.introspectStepper()`
DatePicker | UIDatePicker | `.introspectDatePicker()`
### Not implemented
SwiftUI | UIKit
--- | ---
TabbedView | UITabBarController
### Cannot implement
SwiftUI | Why