Structures
The following structures are available globally.
-
模块可扩展优先级
See moreDeclaration
Swift
public struct ModulePriority : RawRepresentable, Equatable, Hashable, Sendable
-
控制器导航选项定义
See moreDeclaration
Swift
public struct NavigatorOptions : OptionSet, Sendable
-
弹框样式可扩展枚举
See moreDeclaration
Swift
public struct AlertStyle : RawRepresentable, Equatable, Hashable, Sendable
-
网络图片加载选项,默认兼容SDWebImage
See moreDeclaration
Swift
public struct WebImageOptions : OptionSet, Sendable
-
图片选择插件过滤类型
See moreDeclaration
Swift
public struct ImagePickerFilterType : OptionSet, Sendable
-
消息吐司可扩展样式枚举
See moreDeclaration
Swift
public struct ToastStyle : RawRepresentable, Equatable, Hashable, Sendable
-
自定义指示器视图动画类型枚举,可扩展
See moreDeclaration
Swift
public struct IndicatorViewAnimationType : RawRepresentable, Equatable, Hashable, Sendable
-
进度条视图样式枚举,可扩展
See moreDeclaration
Swift
public struct ProgressViewStyle : RawRepresentable, Equatable, Hashable, Sendable
-
指示器视图样式枚举,可扩展
See moreDeclaration
Swift
public struct IndicatorViewStyle : RawRepresentable, Equatable, Hashable, Sendable
-
缓存类型枚举
See moreDeclaration
Swift
public struct CacheType : RawRepresentable, Equatable, Hashable, Sendable
-
Declaration
Swift
@propertyWrapper public struct CachedValue<Value>
-
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
-
Undocumented
See moreDeclaration
Swift
public struct DeserializeOptions : OptionSet, Sendable
-
本地图片解码编码选项,默认兼容SDWebImage
See moreDeclaration
Swift
public struct ImageCoderOptions : RawRepresentable, Equatable, Hashable, Sendable
-
图片格式可扩展枚举
See moreDeclaration
Swift
public struct ImageFormat : RawRepresentable, Equatable, Hashable, Sendable
-
可扩展权限类型
See moreDeclaration
Swift
public struct AuthorizeType : RawRepresentable, Equatable, Hashable, Sendable
-
可扩展屏幕尺寸
See moreDeclaration
Swift
public struct ScreenInch : RawRepresentable, Equatable, Hashable, Sendable
-
UserDefault存储属性包装器注解,兼容AnyArchivable协议,默认为手工指定或初始值
使用示例: @StoredValue(“userName”) static var userName: String = “”
See moreDeclaration
Swift
@propertyWrapper public struct StoredValue<Value>
-
模块属性包装器注解
使用示例: @ModuleValue(UserModuleService.self) static var userModule: UserModuleService
See moreDeclaration
Swift
@propertyWrapper public struct ModuleValue<Value>
-
插件属性包装器注解
使用示例: @PluginValue(TestPluginProtocol.self) static var testPlugin: TestPluginProtocol
See moreDeclaration
Swift
@propertyWrapper public struct PluginValue<Value>
-
路由属性包装器注解
使用示例: @RouterValue(AppRouter.pluginRouter(_:)) static var pluginUrl: String = “app://plugin/:id”
See moreDeclaration
Swift
@propertyWrapper public struct RouterValue
-
导航栏可扩展全局样式
See moreDeclaration
Swift
public struct NavigationBarStyle : RawRepresentable, Equatable, Hashable, Sendable
-
Undocumented
See moreDeclaration
Swift
public struct AnyCodingKey : CodingKey
-
可扩展主题模式(扩展值与样式值相同即可)
See moreDeclaration
Swift
public struct ThemeMode : RawRepresentable, Equatable, Hashable, Sendable
-
视图样式可扩展枚举
定义UIView通用default样式示例:
extension ViewStyle where Base: UIView { public static var `default`: Self { .init("default") } }
自定义UITextField扩展custom样式示例:
See moreextension ViewStyle where Base: UITextField { public static var custom: Self { .init("custom") } }
Declaration
Swift
public struct ViewStyle<Base> : RawRepresentable, Equatable, Hashable, Sendable where Base : UIView
-
规则验证器,可扩展
See moreDeclaration
Swift
public struct Validator<Value> : Sendable
-
A handler for verifying outgoing requests.
See moreDeclaration
Swift
public struct NetworkMockOnRequestHandler
-
Can be used for registering Mocked data, returned by the
See moreMockingURLProtocol
.Declaration
Swift
public struct NetworkMocker
-
A Mock which can be used for mocking data requests with the
See moreMocker
by callingMocker.register(...)
.Declaration
Swift
public struct NetworkMock : Equatable, @unchecked Sendable
-
Undocumented
See moreDeclaration
Swift
public struct WebSocketError : Error
-
Undocumented
Declaration
Swift
public struct WebSocketFrame
-
Undocumented
Declaration
Swift
public struct WebSocketURLParts
-
导航栏配置,兼容AnyView和UIKit对象
See moreDeclaration
Swift
@MainActor public struct NavigationBarConfiguration
-
SwiftUI状态视图
\@State: 内部值传递,赋值时会触发View刷新 \@Binding: 外部引用传递,实现向外传递引用 \@ObservableObject: 可被订阅的对象,属性标记@Published时生效 \@ObservedObject: View订阅监听,收到通知时刷新View,不被View持有,随时可能被销毁,适合外部数据 \@EnvironmentObject: 全局环境对象,使用environmentObject方法绑定,View及其子层级可直接读取 \@StateObject: View引用对象,生命周期和View保持一致,刷新时数据会保持直到View被销毁
See moreDeclaration
Swift
@MainActor public struct StateView : View
-
不可见视图,当某个场景EmptyView不生效时可使用InvisibleView替代,比如EmptyView不触发onAppear
See moreDeclaration
Swift
@MainActor public struct InvisibleView : View
-
富文本组件,兼容NSAttributedString
See moreDeclaration
Swift
@MainActor public struct AttributedText : View
-
图片视图,支持网络图片和动图
See moreDeclaration
Swift
@MainActor public struct ImageView : UIViewRepresentable
-
加载插件视图包装器
See moreDeclaration
Swift
@MainActor public struct LoadingPluginView : UIViewRepresentable
-
进度插件视图包装器
See moreDeclaration
Swift
@MainActor public struct ProgressPluginView : UIViewRepresentable
-
The scope of introspection i.e. where introspect should look to find the desired target view relative to the applied
See more.introspect(...)
modifier.Declaration
Swift
public struct IntrospectionScope : OptionSet, Sendable
-
Undocumented
See moreDeclaration
Swift
@_spi(FW) @MainActor public struct IntrospectionSelector<Target> where Target : PlatformEntity
-
Undocumented
See moreDeclaration
Swift
public struct iOSVersion : PlatformVersion
-
Undocumented
See moreDeclaration
Swift
@MainActor public struct PlatformViewVersionPredicate<SwiftUIViewType, PlatformSpecificEntity> where SwiftUIViewType : IntrospectableViewType, PlatformSpecificEntity : PlatformEntity
-
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
-
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
-
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
-
An abstract representation of the
DatePicker
type in SwiftUI, with.compact
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct DatePickerWithCompactStyleType : IntrospectableViewType
-
An abstract representation of the
DatePicker
type in SwiftUI, with.graphical
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct DatePickerWithGraphicalStyleType : IntrospectableViewType
-
An abstract representation of the
DatePicker
type in SwiftUI, with.wheel
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct DatePickerWithWheelStyleType : IntrospectableViewType
-
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
-
An abstract representation of the
Form
type in SwiftUI, with.grouped
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct FormWithGroupedStyleType : IntrospectableViewType
-
An abstract representation of
.fullScreenCover
in SwiftUI.
See morepublic 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 } } } }
Declaration
Swift
@MainActor public struct FullScreenCoverType : IntrospectableViewType
-
An abstract representation of the
List
type in SwiftUI.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct ListType : IntrospectableViewType
-
An abstract representation of the
List
type in SwiftUI, with.grouped
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct ListWithGroupedStyleType : IntrospectableViewType
-
An abstract representation of the
List
type in SwiftUI, with.insetGrouped
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct ListWithInsetGroupedStyleType : IntrospectableViewType
-
An abstract representation of the
List
type in SwiftUI, with.inset
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct ListWithInsetStyleType : IntrospectableViewType
-
An abstract representation of the
List
type in SwiftUI, with.sidebar
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct ListWithSidebarStyleType : IntrospectableViewType
-
An abstract representation of a
List
cell type in SwiftUI.
See morestruct 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 } } } } }
Declaration
Swift
@MainActor public struct ListCellType : IntrospectableViewType
-
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
-
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
-
An abstract representation of the
NavigationView
type in SwiftUI, with.columns
style.
See morestruct ContentView: View { var body: some View { NavigationView { Text("Root") } .navigationViewStyle(DoubleColumnNavigationViewStyle()) .introspect(.navigationView(style: .columns), on: .iOS(.all)) { print(type(of: $0)) // UISplitViewController } } }
Declaration
Swift
@MainActor public struct NavigationViewWithColumnsStyleType : IntrospectableViewType
-
An abstract representation of the
NavigationView
type in SwiftUI, with.stack
style.
See morestruct ContentView: View { var body: some View { NavigationView { Text("Root") } .navigationViewStyle(.stack) .introspect(.navigationView(style: .stack), on: .iOS(.all)) { print(type(of: $0)) // UINavigationController } } }
Declaration
Swift
@MainActor public struct NavigationViewWithStackStyleType : IntrospectableViewType
-
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
-
An abstract representation of the
Picker
type in SwiftUI, with.segmented
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct PickerWithSegmentedStyleType : IntrospectableViewType
-
An abstract representation of the
Picker
type in SwiftUI, with.wheel
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct PickerWithWheelStyleType : IntrospectableViewType
-
An abstract representation of
.popover
in SwiftUI.
See morepublic 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 } } } }
Declaration
Swift
@MainActor public struct PopoverType : IntrospectableViewType
-
An abstract representation of the
ProgressView
type in SwiftUI, with.circular
style.
See morestruct ContentView: View { var body: some View { ProgressView(value: 0.5) .progressViewStyle(.circular) .introspect(.progressView(style: .circular), on: .iOS(.v14Later)) { print(type(of: $0)) // UIActivityIndicatorView } } }
Declaration
Swift
@MainActor public struct ProgressViewWithCircularStyleType : IntrospectableViewType
-
An abstract representation of the
ProgressView
type in SwiftUI, with.linear
style.
See morestruct ContentView: View { var body: some View { ProgressView(value: 0.5) .progressViewStyle(.linear) .introspect(.progressView(style: .linear), on: .iOS(.v14Later)) { print(type(of: $0)) // UIProgressView } } }
Declaration
Swift
@MainActor public struct ProgressViewWithLinearStyleType : IntrospectableViewType
-
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
-
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
-
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
-
An abstract representation of
.sheet
in SwiftUI.
See morepublic 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 } } } }
Declaration
Swift
@MainActor public struct SheetType : IntrospectableViewType
-
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
-
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
-
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
-
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
-
An abstract representation of the
TabView
type in SwiftUI, with.page
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct TabViewWithPageStyleType : IntrospectableViewType
-
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
-
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
-
An abstract representation of the
TextField
type in SwiftUI, with.vertical
axis.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct TextFieldWithVerticalAxisType : IntrospectableViewType
-
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
-
An abstract representation of the
Toggle
type in SwiftUI, with.switch
style.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct ToggleWithSwitchStyleType : IntrospectableViewType
-
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.
See morestruct 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 } } }
Declaration
Swift
@MainActor public struct ViewControllerType : IntrospectableViewType
-
线条形状,用于分割线、虚线等。自定义路径形状:Path { (path) in … } 常用分割线:Rectangle.foregroundColor替代Divider组件
See moreDeclaration
Swift
public struct LineShape : Shape
-
不规则圆角形状
See moreDeclaration
Swift
public struct RoundedCornerShape : Shape
-
视图移除性修改器
See moreDeclaration
Swift
@MainActor public struct RemovableModifier : ViewModifier
-
透明度按钮样式,支持设置高亮和禁用时的透明度
See moreDeclaration
Swift
@MainActor public struct OpacityButtonStyle : ButtonStyle
-
通用UIView包装器
See moreDeclaration
Swift
@MainActor public struct ViewWrapper<T> : UIViewRepresentable where T : UIView
-
通用UIViewController包装器
See moreDeclaration
Swift
@MainActor public struct ViewControllerWrapper<T> : UIViewControllerRepresentable where T : UIViewController