Structures

The following structures are available globally.

Logger

  • 日志类型枚举

    See more

    Declaration

    Swift

    public struct LogType : OptionSet, Sendable
  • 日志级别定义

    See more

    Declaration

    Swift

    public struct LogLevel : RawRepresentable, Equatable, Hashable, Sendable

ModulePriority

  • 模块可扩展优先级

    See more

    Declaration

    Swift

    public struct ModulePriority : RawRepresentable, Equatable, Hashable, Sendable

NavigatorOptions

  • 控制器导航选项定义

    See more

    Declaration

    Swift

    public struct NavigatorOptions : OptionSet, Sendable

TestSuite

  • 可扩展测试套件,默认automatic

    See more

    Declaration

    Swift

    public struct TestSuite : RawRepresentable, Equatable, Hashable, Sendable
  • Undocumented

    See more

    Declaration

    Swift

    public struct SegmentedControlBorderType : OptionSet, Sendable

AlertPlugin

  • 弹框样式可扩展枚举

    See more

    Declaration

    Swift

    public struct AlertStyle : RawRepresentable, Equatable, Hashable, Sendable

ImagePlugin

  • 网络图片加载选项,默认兼容SDWebImage

    See more

    Declaration

    Swift

    public struct WebImageOptions : OptionSet, Sendable

ImagePickerPlugin

ToastPlugin

  • 消息吐司可扩展样式枚举

    See more

    Declaration

    Swift

    public struct ToastStyle : RawRepresentable, Equatable, Hashable, Sendable

IndicatorViewAnimation

  • 自定义指示器视图动画类型枚举,可扩展

    See more

    Declaration

    Swift

    public struct IndicatorViewAnimationType : RawRepresentable, Equatable, Hashable, Sendable

ProgressViewPlugin

  • 进度条视图样式枚举,可扩展

    See more

    Declaration

    Swift

    public struct ProgressViewStyle : RawRepresentable, Equatable, Hashable, Sendable

IndicatorViewPlugin

  • 指示器视图样式枚举,可扩展

    See more

    Declaration

    Swift

    public struct IndicatorViewStyle : RawRepresentable, Equatable, Hashable, Sendable

CacheType

  • 缓存类型枚举

    See more

    Declaration

    Swift

    public struct CacheType : RawRepresentable, Equatable, Hashable, Sendable

CachedValue

  • 缓存属性包装器注解,默认为手工指定或初始值

    使用示例: @CachedValue(“cacheKey”) static var cacheValue: String = “”

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct CachedValue<Value>

JSON

  • JSON

    See more

    Declaration

    Swift

    @dynamicMemberLookup
    public struct JSON : @unchecked Sendable
    extension JSON: AnyModel
    extension JSON: Swift.Collection
    extension JSON: Swift.ExpressibleByStringLiteral
    extension JSON: Swift.ExpressibleByIntegerLiteral
    extension JSON: Swift.ExpressibleByBooleanLiteral
    extension JSON: Swift.ExpressibleByFloatLiteral
    extension JSON: Swift.ExpressibleByDictionaryLiteral
    extension JSON: Swift.ExpressibleByArrayLiteral
    extension JSON: Swift.RawRepresentable
    extension JSON: Swift.CustomStringConvertible, Swift.CustomDebugStringConvertible
    extension JSON: Swift.Comparable
    extension JSON: Codable

Configuration

ImageCoderOptions

  • 本地图片解码编码选项,默认兼容SDWebImage

    See more

    Declaration

    Swift

    public struct ImageCoderOptions : RawRepresentable, Equatable, Hashable, Sendable

ImageFormat

  • 图片格式可扩展枚举

    See more

    Declaration

    Swift

    public struct ImageFormat : RawRepresentable, Equatable, Hashable, Sendable

AuthorizeType

  • 可扩展权限类型

    See more

    Declaration

    Swift

    public struct AuthorizeType : RawRepresentable, Equatable, Hashable, Sendable

ScreenInch

  • 可扩展屏幕尺寸

    See more

    Declaration

    Swift

    public struct ScreenInch : RawRepresentable, Equatable, Hashable, Sendable

StoredValue

  • UserDefault存储属性包装器注解,兼容AnyArchivable协议,默认为手工指定或初始值

    使用示例: @StoredValue(“userName”) static var userName: String = “”

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct StoredValue<Value>

ModuleValue

  • 模块属性包装器注解

    使用示例: @ModuleValue(UserModuleService.self) static var userModule: UserModuleService

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct ModuleValue<Value>

PluginValue

  • 插件属性包装器注解

    使用示例: @PluginValue(TestPluginProtocol.self) static var testPlugin: TestPluginProtocol

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct PluginValue<Value>

RouterValue

  • 路由属性包装器注解

    使用示例: @RouterValue(AppRouter.pluginRouter(_:)) static var pluginUrl: String = “app://plugin/:id”

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct RouterValue

NavigationStyle

  • 导航栏可扩展全局样式

    See more

    Declaration

    Swift

    public struct NavigationBarStyle : RawRepresentable, Equatable, Hashable, Sendable

AnyCodingKey

ArrayResultBuilder

ThemeManager

  • 可扩展主题模式(扩展值与样式值相同即可)

    See more

    Declaration

    Swift

    public struct ThemeMode : RawRepresentable, Equatable, Hashable, Sendable

ViewStyle

  • 视图样式可扩展枚举

    定义UIView通用default样式示例:

    extension ViewStyle where Base: UIView {
        public static var `default`: Self { .init("default") }
    }
    

    自定义UITextField扩展custom样式示例:

    extension ViewStyle where Base: UITextField {
        public static var custom: Self { .init("custom") }
    }
    
    See more

    Declaration

    Swift

    public struct ViewStyle<Base> : RawRepresentable, Equatable, Hashable, Sendable where Base : UIView

Validator

  • 规则验证器,可扩展

    See more

    Declaration

    Swift

    public struct Validator<Value> : Sendable
  • A handler for verifying outgoing requests.

    See more

    Declaration

    Swift

    public struct NetworkMockOnRequestHandler
  • Can be used for registering Mocked data, returned by the MockingURLProtocol.

    See more

    Declaration

    Swift

    public struct NetworkMocker
  • A Mock which can be used for mocking data requests with the Mocker by calling Mocker.register(...).

    See more

    Declaration

    Swift

    public struct NetworkMock : Equatable, @unchecked Sendable

WebSocket

Framer

  • Undocumented

    Declaration

    Swift

    public struct WebSocketFrame

functions for simpler array buffer reading and writing

StateView

  • SwiftUI状态视图

    \@State: 内部值传递,赋值时会触发View刷新 \@Binding: 外部引用传递,实现向外传递引用 \@ObservableObject: 可被订阅的对象,属性标记@Published时生效 \@ObservedObject: View订阅监听,收到通知时刷新View,不被View持有,随时可能被销毁,适合外部数据 \@EnvironmentObject: 全局环境对象,使用environmentObject方法绑定,View及其子层级可直接读取 \@StateObject: View引用对象,生命周期和View保持一致,刷新时数据会保持直到View被销毁

    See more

    Declaration

    Swift

    @MainActor
    public struct StateView : View

InvisibleView

  • 不可见视图,当某个场景EmptyView不生效时可使用InvisibleView替代,比如EmptyView不触发onAppear

    See more

    Declaration

    Swift

    @MainActor
    public struct InvisibleView : View

AttributedText

  • 富文本组件,兼容NSAttributedString

    See more

    Declaration

    Swift

    @MainActor
    public struct AttributedText : View

ImageView

  • 图片视图,支持网络图片和动图

    See more

    Declaration

    Swift

    @MainActor
    public struct ImageView : UIViewRepresentable

LoadingPluginView

  • 加载插件视图包装器

    See more

    Declaration

    Swift

    @MainActor
    public struct LoadingPluginView : UIViewRepresentable

ProgressPluginView

  • 进度插件视图包装器

    See more

    Declaration

    Swift

    @MainActor
    public struct ProgressPluginView : UIViewRepresentable

EmptyPluginView

  • 空界面插件视图包装器。如果需要显示空界面时可滚动,放到滚动视图内部即可

    See more

    Declaration

    Swift

    @MainActor
    public struct EmptyPluginView : UIViewRepresentable
  • 网络图片视图,仅支持静态图

    See more

    Declaration

    Swift

    @MainActor
    public struct WebImageView : View

Introspect

  • The scope of introspection i.e. where introspect should look to find the desired target view relative to the applied .introspect(...) modifier.

    SwiftUI-Introspect

    See more

    Declaration

    Swift

    public struct IntrospectionScope : OptionSet, Sendable

IntrospectionSelector

PlatformVersion

PlatformViewVersion

ViewTypes

  • An abstract representation of a generic SwiftUI view type.

    struct ContentView: View {
        var body: some View {
            HStack {
                Image(systemName: "scribble")
                Text("Some text")
            }
            .introspect(.view, on: .iOS(.all)) {
                print(type(of: $0)) // some subclass of UIView
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct ViewType : IntrospectableViewType

ColorPicker

  • An abstract representation of the ColorPicker type in SwiftUI.

    struct ContentView: View {
        @State var color = Color.red
    
        var body: some View {
            ColorPicker("Pick a color", selection: $color)
                .introspect(.colorPicker, on: .iOS(.v14Later)) {
                    print(type(of: $0)) // UIColorPicker
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct ColorPickerType : IntrospectableViewType

DatePicker

  • An abstract representation of the DatePicker type in SwiftUI.

    struct ContentView: View {
        @State var date = Date()
    
        var body: some View {
            DatePicker("Pick a date", selection: $date)
                .introspect(.datePicker, on: .iOS(.all)) {
                    print(type(of: $0)) // UIDatePicker
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct DatePickerType : IntrospectableViewType

DatePickerWithCompactStyle

  • An abstract representation of the DatePicker type in SwiftUI, with .compact style.

    struct ContentView: View {
        @State var date = Date()
    
        var body: some View {
            DatePicker("Pick a date", selection: $date)
                .datePickerStyle(.compact)
                .introspect(.datePicker(style: .compact), on: .iOS(.v14Later)) {
                    print(type(of: $0)) // UIDatePicker
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct DatePickerWithCompactStyleType : IntrospectableViewType

DatePickerWithGraphicalStyle

  • An abstract representation of the DatePicker type in SwiftUI, with .graphical style.

    struct ContentView: View {
        @State var date = Date()
    
        var body: some View {
            DatePicker("Pick a date", selection: $date)
                .datePickerStyle(.graphical)
                .introspect(.datePicker(style: .graphical), on: .iOS(.v14Later)) {
                    print(type(of: $0)) // UIDatePicker
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct DatePickerWithGraphicalStyleType : IntrospectableViewType

DatePickerWithWheelStyle

  • An abstract representation of the DatePicker type in SwiftUI, with .wheel style.

    struct ContentView: View {
        @State var date = Date()
    
        var body: some View {
            DatePicker("Pick a date", selection: $date)
                .datePickerStyle(.wheel)
                .introspect(.datePicker(style: .wheel), on: .iOS(.all)) {
                    print(type(of: $0)) // UIDatePicker
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct DatePickerWithWheelStyleType : IntrospectableViewType

Form

  • An abstract representation of the Form type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            Form {
                Text("Item 1")
                Text("Item 2")
                Text("Item 3")
            }
            .introspect(.form, on: .iOS(.v15Earlier)) {
                print(type(of: $0)) // UITableView
            }
            .introspect(.form, on: .iOS(.v16Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct FormType : IntrospectableViewType

FormWithGroupedStyle

  • An abstract representation of the Form type in SwiftUI, with .grouped style.

    struct ContentView: View {
        var body: some View {
            Form {
                Text("Item 1")
                Text("Item 2")
                Text("Item 3")
            }
            .formStyle(.grouped)
            .introspect(.form(style: .grouped), on: .iOS(.v16Later)) {
                print(type(of: $0)) // UITableView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct FormWithGroupedStyleType : IntrospectableViewType

FullScreenCover

  • An abstract representation of .fullScreenCover in SwiftUI.

    public struct ContentView: View {
        @State var isPresented = false
    
        public var body: some View {
            Button("Present", action: { isPresented = true })
                .fullScreenCover(isPresented: $isPresented) {
                    Button("Dismiss", action: { isPresented = false })
                        .introspect(.fullScreenCover, on: .iOS(.v14Later)) {
                            print(type(of: $0)) // UIPresentationController
                        }
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct FullScreenCoverType : IntrospectableViewType

List

  • An abstract representation of the List type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            List {
                Text("Item 1")
                Text("Item 2")
                Text("Item 3")
            }
            .introspect(.list, on: .iOS(.v15Earlier)) {
                print(type(of: $0)) // UITableView
            }
            .introspect(.list, on: .iOS(.v16Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ListType : IntrospectableViewType

ListWithGroupedStyle

  • An abstract representation of the List type in SwiftUI, with .grouped style.

    struct ContentView: View {
        var body: some View {
            List {
                Text("Item 1")
                Text("Item 2")
                Text("Item 3")
            }
            .listStyle(.grouped)
            .introspect(.list(style: .grouped), on: .iOS(.v15Earlier)) {
                print(type(of: $0)) // UITableView
            }
            .introspect(.list(style: .grouped), on: .iOS(.v16Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ListWithGroupedStyleType : IntrospectableViewType

ListWithInsetGroupedStyleType

  • An abstract representation of the List type in SwiftUI, with .insetGrouped style.

    struct ContentView: View {
        var body: some View {
            List {
                Text("Item 1")
                Text("Item 2")
                Text("Item 3")
            }
            .listStyle(.insetGrouped)
            .introspect(.list(style: .insetGrouped), on: .iOS(.v15Earlier14)) {
                print(type(of: $0)) // UITableView
            }
            .introspect(.list(style: .insetGrouped), on: .iOS(.v16Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ListWithInsetGroupedStyleType : IntrospectableViewType

ListWithInsetStyle

  • An abstract representation of the List type in SwiftUI, with .inset style.

    struct ContentView: View {
        var body: some View {
            List {
                Text("Item 1")
                Text("Item 2")
                Text("Item 3")
            }
            .listStyle(.inset)
            .introspect(.list(style: .inset), on: .iOS(.v15Earlier14)) {
                print(type(of: $0)) // UITableView
            }
            .introspect(.list(style: .inset), on: .iOS(.v16Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ListWithInsetStyleType : IntrospectableViewType

ListWithSidebarStyle

  • An abstract representation of the List type in SwiftUI, with .sidebar style.

    struct ContentView: View {
        var body: some View {
            List {
                Text("Item 1")
                Text("Item 2")
                Text("Item 3")
            }
            .listStyle(.sidebar)
            .introspect(.list(style: .sidebar), on: .iOS(.v15Earlier14)) {
                print(type(of: $0)) // UITableView
            }
            .introspect(.list(style: .sidebar), on: .iOS(.v16Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ListWithSidebarStyleType : IntrospectableViewType

ListCell

  • An abstract representation of a List cell type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            List {
                ForEach(1...3, id: \.self) { int in
                    Text("Item \(int)")
                        .introspect(.listCell, on: .iOS(.v15Earlier)) {
                            print(type(of: $0)) // UITableViewCell
                        }
                        .introspect(.listCell, on: .iOS(.v16Later)) {
                            print(type(of: $0)) // UICollectionViewCell
                        }
                }
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ListCellType : IntrospectableViewType

NavigationSplitView

  • An abstract representation of the NavigationSplitView type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            NavigationSplitView {
                Text("Root")
            } detail: {
                Text("Detail")
            }
            .introspect(.navigationSplitView, on: .iOS(.v16Later)) {
                print(type(of: $0)) // UISplitViewController
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct NavigationSplitViewType : IntrospectableViewType

NavigationStack

  • An abstract representation of the NavigationStack type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            NavigationStack {
                Text("Root")
            }
            .introspect(.navigationStack, on: .iOS(.v16Later)) {
                print(type(of: $0)) // UINavigationController
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct NavigationStackType : IntrospectableViewType

NavigationViewWithColumnsStyle

  • An abstract representation of the NavigationView type in SwiftUI, with .columns style.

    struct ContentView: View {
        var body: some View {
            NavigationView {
                Text("Root")
            }
            .navigationViewStyle(DoubleColumnNavigationViewStyle())
            .introspect(.navigationView(style: .columns), on: .iOS(.all)) {
                print(type(of: $0)) // UISplitViewController
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct NavigationViewWithColumnsStyleType : IntrospectableViewType

NavigationViewWithStackStyle

  • An abstract representation of the NavigationView type in SwiftUI, with .stack style.

    struct ContentView: View {
        var body: some View {
            NavigationView {
                Text("Root")
            }
            .navigationViewStyle(.stack)
            .introspect(.navigationView(style: .stack), on: .iOS(.all)) {
                print(type(of: $0)) // UINavigationController
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct NavigationViewWithStackStyleType : IntrospectableViewType

PageControl

  • An abstract representation of the page control type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            TabView {
                Text("Page 1").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.red)
                Text("Page 2").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.blue)
            }
            .tabViewStyle(.page(indexDisplayMode: .always))
            .introspect(.pageControl, on: .iOS(.v14Later)) {
                print(type(of: $0)) // UIPageControl
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct PageControlType : IntrospectableViewType

PickerWithSegmentedStyle

  • An abstract representation of the Picker type in SwiftUI, with .segmented style.

    struct ContentView: View {
        @State var selection = "1"
    
        var body: some View {
            Picker("Pick a number", selection: $selection) {
                Text("1").tag("1")
                Text("2").tag("2")
                Text("3").tag("3")
            }
            .pickerStyle(.segmented)
            .introspect(.picker(style: .segmented), on: .iOS(.all)) {
                print(type(of: $0)) // UISegmentedControl
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct PickerWithSegmentedStyleType : IntrospectableViewType

PickerWithWheelStyle

  • An abstract representation of the Picker type in SwiftUI, with .wheel style.

    struct ContentView: View {
        @State var selection = "1"
    
        var body: some View {
            Picker("Pick a number", selection: $selection) {
                Text("1").tag("1")
                Text("2").tag("2")
                Text("3").tag("3")
            }
            .pickerStyle(.wheel)
            .introspect(.picker(style: .wheel), on: .iOS(.all)) {
                print(type(of: $0)) // UIPickerView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct PickerWithWheelStyleType : IntrospectableViewType

Popover

  • An abstract representation of .popover in SwiftUI.

    public struct ContentView: View {
        @State var isPresented = false
    
        public var body: some View {
            Button("Present", action: { isPresented = true })
                .popover(isPresented: $isPresented) {
                    Button("Dismiss", action: { isPresented = false })
                        .introspect(.popover, on: .iOS(.all)) {
                            print(type(of: $0)) // UIPopoverPresentationController
                        }
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct PopoverType : IntrospectableViewType

ProgressViewWithCircularStyle

  • An abstract representation of the ProgressView type in SwiftUI, with .circular style.

    struct ContentView: View {
        var body: some View {
            ProgressView(value: 0.5)
                .progressViewStyle(.circular)
                .introspect(.progressView(style: .circular), on: .iOS(.v14Later)) {
                    print(type(of: $0)) // UIActivityIndicatorView
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ProgressViewWithCircularStyleType : IntrospectableViewType

ProgressViewWithLinearStyle

  • An abstract representation of the ProgressView type in SwiftUI, with .linear style.

    struct ContentView: View {
        var body: some View {
            ProgressView(value: 0.5)
                .progressViewStyle(.linear)
                .introspect(.progressView(style: .linear), on: .iOS(.v14Later)) {
                    print(type(of: $0)) // UIProgressView
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ProgressViewWithLinearStyleType : IntrospectableViewType

ScrollView

  • An abstract representation of the ScrollView type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            ScrollView {
                Text("Item")
            }
            .introspect(.scrollView, on: .iOS(.all)) {
                print(type(of: $0)) // UIScrollView
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct ScrollViewType : IntrospectableViewType

SearchField

  • An abstract representation of the search field displayed via the .searchable modifier in SwiftUI.

    struct ContentView: View {
        @State var searchTerm = ""
    
        var body: some View {
            NavigationView {
                Text("Root")
                    .searchable(text: $searchTerm)
            }
            .navigationViewStyle(.stack)
            .introspect(.searchField, on: .iOS(.v15Later)) {
                print(type(of: $0)) // UISearchBar
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct SearchFieldType : IntrospectableViewType

SecureField

  • An abstract representation of the SecureField type in SwiftUI.

    struct ContentView: View {
        @State var text = "Lorem ipsum"
    
        var body: some View {
            SecureField("Secure Field", text: $text)
                .introspect(.secureField, on: .iOS(.all)) {
                    print(type(of: $0)) // UISecureField
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct SecureFieldType : IntrospectableViewType

Sheet

  • An abstract representation of .sheet in SwiftUI.

    public struct ContentView: View {
        @State var isPresented = false
    
        public var body: some View {
            Button("Present", action: { isPresented = true })
                .sheet(isPresented: $isPresented) {
                    Button("Dismiss", action: { isPresented = false })
                        .introspect(.sheet, on: .iOS(.all)) {
                            print(type(of: $0)) // UIPresentationController
                        }
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct SheetType : IntrospectableViewType

Slider

  • An abstract representation of the Slider type in SwiftUI.

    struct ContentView: View {
        @State var selection = 0.5
    
        var body: some View {
            Slider(value: $selection, in: 0...1)
                .introspect(.slider, on: .iOS(.all)) {
                    print(type(of: $0)) // UISlider
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct SliderType : IntrospectableViewType

Stepper

  • An abstract representation of the Stepper type in SwiftUI.

    iOS

    struct ContentView: View {
        @State var selection = 5
    
        var body: some View {
            Stepper("Select a number", value: $selection, in: 0...10)
                .introspect(.stepper, on: .iOS(.all)) {
                    print(type(of: $0)) // UIStepper
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct StepperType : IntrospectableViewType

Table

  • An abstract representation of the Table type in SwiftUI, with any style.

    struct ContentView: View {
        struct Purchase: Identifiable {
            let id = UUID()
            let price: Decimal
        }
    
        var body: some View {
            Table(of: Purchase.self) {
                TableColumn("Base price") { purchase in
                    Text(purchase.price, format: .currency(code: "USD"))
                }
                TableColumn("With 15% tip") { purchase in
                    Text(purchase.price * 1.15, format: .currency(code: "USD"))
                }
                TableColumn("With 20% tip") { purchase in
                    Text(purchase.price * 1.2, format: .currency(code: "USD"))
                }
            } rows: {
                TableRow(Purchase(price: 20))
                TableRow(Purchase(price: 50))
                TableRow(Purchase(price: 75))
            }
            .introspect(.table, on: .iOS(.v16Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct TableType : IntrospectableViewType

TabView

  • An abstract representation of the TabView type in SwiftUI.

    struct ContentView: View {
        var body: some View {
            TabView {
                Text("Tab 1").tabItem { Text("Tab 1") }
                Text("Tab 2").tabItem { Text("Tab 2") }
            }
            .introspect(.tabView, on: .iOS(.all)) {
                print(type(of: $0)) // UITabBarController
            }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct TabViewType : IntrospectableViewType

TabViewWithPageStyle

  • An abstract representation of the TabView type in SwiftUI, with .page style.

    struct ContentView: View {
        var body: some View {
            TabView {
                Text("Page 1").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.red)
                Text("Page 2").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.blue)
            }
            .tabViewStyle(.page(indexDisplayMode: .always))
            .introspect(.tabView(style: .page), on: .iOS(.v14Later)) {
                print(type(of: $0)) // UICollectionView
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct TabViewWithPageStyleType : IntrospectableViewType

TextEditor

  • An abstract representation of the TextEditor type in SwiftUI.

    struct ContentView: View {
        @State var text = "Lorem ipsum"
    
        var body: some View {
            TextEditor(text: $text)
                .introspect(.textEditor, on: .iOS(.v14Later)) {
                    print(type(of: $0)) // UITextView
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct TextEditorType : IntrospectableViewType

TextField

  • An abstract representation of the TextField type in SwiftUI.

    struct ContentView: View {
        @State var text = "Lorem ipsum"
    
        var body: some View {
            TextField("Text Field", text: $text)
                .introspect(.textField, on: .iOS(.all)) {
                    print(type(of: $0)) // UITextField
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct TextFieldType : IntrospectableViewType

TextFieldWithVerticalAxis

  • An abstract representation of the TextField type in SwiftUI, with .vertical axis.

    struct ContentView: View {
        @State var text = "Lorem ipsum"
    
        var body: some View {
            TextField("Text Field", text: $text, axis: .vertical)
                .introspect(.textField(axis: .vertical), on: .iOS(.v16Later)) {
                    print(type(of: $0)) // UITextView
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct TextFieldWithVerticalAxisType : IntrospectableViewType

Toggle

  • An abstract representation of the Toggle type in SwiftUI.

    struct ContentView: View {
        @State var isOn = false
    
        var body: some View {
            Toggle("Toggle", isOn: $isOn)
                .introspect(.toggle, on: .iOS(.all)) {
                    print(type(of: $0)) // UISwitch
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct ToggleType : IntrospectableViewType

ToggleWithSwitchStyle

  • An abstract representation of the Toggle type in SwiftUI, with .switch style.

    struct ContentView: View {
        @State var isOn = false
    
        var body: some View {
            Toggle("Switch", isOn: $isOn)
                .toggleStyle(.switch)
                .introspect(.toggle(style: .switch), on: .iOS(.all)) {
                    print(type(of: $0)) // UISwitch
                }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ToggleWithSwitchStyleType : IntrospectableViewType

Window

  • An abstract representation of a view’s window in SwiftUI.

    struct ContentView: View {
        var body: some View {
            Text("Content")
                .introspect(.window, on: .iOS(.all)) {
                    print(type(of: $0)) // UIWindow
                }
        }
    }
    

    Declaration

    Swift

    @MainActor
    public struct WindowType : IntrospectableViewType
  • An abstract representation of the receiving SwiftUI view’s view controller, or the closest ancestor view controller if missing.

    struct ContentView: View {
        var body: some View {
            NavigationView {
                Text("Root").frame(maxWidth: .infinity, maxHeight: .infinity).background(Color.red)
                    .introspect(.viewController, on: .iOS(.all)) {
                        print(type(of: $0)) // some subclass of UIHostingController
                    }
            }
            .navigationViewStyle(.stack)
            .introspect(.viewController, on: .iOS(.all)) {
                print(type(of: $0)) // UINavigationController
            }
        }
    }
    
    See more

    Declaration

    Swift

    @MainActor
    public struct ViewControllerType : IntrospectableViewType

View+Toolkit

  • 线条形状,用于分割线、虚线等。自定义路径形状:Path { (path) in … } 常用分割线:Rectangle.foregroundColor替代Divider组件

    See more

    Declaration

    Swift

    public struct LineShape : Shape
  • 不规则圆角形状

    See more

    Declaration

    Swift

    public struct RoundedCornerShape : Shape
  • 视图移除性修改器

    See more

    Declaration

    Swift

    @MainActor
    public struct RemovableModifier : ViewModifier

Button+Toolkit

  • 透明度按钮样式,支持设置高亮和禁用时的透明度

    See more

    Declaration

    Swift

    @MainActor
    public struct OpacityButtonStyle : ButtonStyle

ViewWrapper

  • 通用UIView包装器

    See more

    Declaration

    Swift

    @MainActor
    public struct ViewWrapper<T> : UIViewRepresentable where T : UIView

ViewControllerWrapper

  • 通用UIViewController包装器

    See more

    Declaration

    Swift

    @MainActor
    public struct ViewControllerWrapper<T> : UIViewControllerRepresentable where T : UIViewController