Showing preview only (464K chars total). Download the full file or copy to clipboard to get everything.
Repository: siteline/swiftui-introspect
Branch: main
Commit: 26986a57e31c
Files: 158
Total size: 423.3 KB
Directory structure:
gitextract_d1c0xsyf/
├── .editorconfig
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ └── config.yml
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .spi.yml
├── .swift-version
├── .swiftformat
├── Examples/
│ ├── .swiftpm/
│ │ └── xcode/
│ │ └── package.xcworkspace/
│ │ └── contents.xcworkspacedata
│ ├── Package.swift
│ └── Showcase/
│ ├── Showcase/
│ │ ├── App.swift
│ │ ├── AppView.swift
│ │ ├── Controls.swift
│ │ ├── Helpers.swift
│ │ ├── List.swift
│ │ ├── Navigation.swift
│ │ ├── Presentation.swift
│ │ ├── ScrollView.swift
│ │ ├── Showcase.entitlements
│ │ └── UIViewRepresentable.swift
│ └── Showcase.xcodeproj/
│ ├── project.pbxproj
│ ├── project.xcworkspace/
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata/
│ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata/
│ └── xcschemes/
│ └── Showcase.xcscheme
├── LICENSE
├── Package.swift
├── README.md
├── Sources/
│ ├── Introspect.swift
│ ├── IntrospectableViewType.swift
│ ├── IntrospectionSelector.swift
│ ├── IntrospectionView.swift
│ ├── PlatformVersion.swift
│ ├── PlatformView.swift
│ ├── PlatformViewVersion.swift
│ ├── Utils.swift
│ ├── ViewTypes/
│ │ ├── Button.swift
│ │ ├── ColorPicker.swift
│ │ ├── DatePicker.swift
│ │ ├── DatePickerWithCompactStyle.swift
│ │ ├── DatePickerWithFieldStyle.swift
│ │ ├── DatePickerWithGraphicalStyle.swift
│ │ ├── DatePickerWithStepperFieldStyle.swift
│ │ ├── DatePickerWithWheelStyle.swift
│ │ ├── Form.swift
│ │ ├── FormWithGroupedStyle.swift
│ │ ├── FullScreenCover.swift
│ │ ├── List.swift
│ │ ├── ListCell.swift
│ │ ├── ListWithBorderedStyle.swift
│ │ ├── ListWithGroupedStyle.swift
│ │ ├── ListWithInsetGroupedStyle.swift
│ │ ├── ListWithInsetStyle.swift
│ │ ├── ListWithSidebarStyle.swift
│ │ ├── Map.swift
│ │ ├── NavigationSplitView.swift
│ │ ├── NavigationStack.swift
│ │ ├── NavigationViewWithColumnsStyle.swift
│ │ ├── NavigationViewWithStackStyle.swift
│ │ ├── PageControl.swift
│ │ ├── PickerWithMenuStyle.swift
│ │ ├── PickerWithSegmentedStyle.swift
│ │ ├── PickerWithWheelStyle.swift
│ │ ├── Popover.swift
│ │ ├── ProgressViewWithCircularStyle.swift
│ │ ├── ProgressViewWithLinearStyle.swift
│ │ ├── ScrollView.swift
│ │ ├── SearchField.swift
│ │ ├── SecureField.swift
│ │ ├── Sheet.swift
│ │ ├── SignInWithAppleButton.swift
│ │ ├── Slider.swift
│ │ ├── Stepper.swift
│ │ ├── TabView.swift
│ │ ├── TabViewWithPageStyle.swift
│ │ ├── Table.swift
│ │ ├── TextEditor.swift
│ │ ├── TextField.swift
│ │ ├── TextFieldWithVerticalAxis.swift
│ │ ├── Toggle.swift
│ │ ├── ToggleWithButtonStyle.swift
│ │ ├── ToggleWithCheckboxStyle.swift
│ │ ├── ToggleWithSwitchStyle.swift
│ │ ├── VideoPlayer.swift
│ │ ├── View.swift
│ │ ├── ViewController.swift
│ │ ├── WebView.swift
│ │ └── Window.swift
│ └── Weak.swift
├── SwiftUIIntrospect.podspec
├── SwiftUIIntrospect.xcworkspace/
│ ├── contents.xcworkspacedata
│ └── xcshareddata/
│ ├── IDEWorkspaceChecks.plist
│ ├── WorkspaceSettings.xcsettings
│ └── xcschemes/
│ └── SwiftUIIntrospect.xcscheme
├── Tests/
│ ├── TestFramework/
│ │ └── TestFramework.swift
│ ├── Tests/
│ │ ├── PlatformVersionTests.swift
│ │ ├── TestUtils.swift
│ │ ├── ViewTypes/
│ │ │ ├── ButtonTests.swift
│ │ │ ├── ColorPickerTests.swift
│ │ │ ├── DatePickerTests.swift
│ │ │ ├── DatePickerWithCompactFieldStyleTests.swift
│ │ │ ├── DatePickerWithFieldStyleTests.swift
│ │ │ ├── DatePickerWithGraphicalStyleTests.swift
│ │ │ ├── DatePickerWithStepperFieldStyleTests.swift
│ │ │ ├── DatePickerWithWheelStyleTests.swift
│ │ │ ├── FormTests.swift
│ │ │ ├── FormWithGroupedStyleTests.swift
│ │ │ ├── FullScreenCoverTests.swift
│ │ │ ├── ListCellTests.swift
│ │ │ ├── ListTests.swift
│ │ │ ├── ListWithBorderedStyleTests.swift
│ │ │ ├── ListWithGroupedStyleTests.swift
│ │ │ ├── ListWithInsetGroupedStyleTests.swift
│ │ │ ├── ListWithInsetStyleTests.swift
│ │ │ ├── ListWithPlainStyleTests.swift
│ │ │ ├── ListWithSidebarStyleTests.swift
│ │ │ ├── MapTests.swift
│ │ │ ├── NavigationSplitViewTests.swift
│ │ │ ├── NavigationStackTests.swift
│ │ │ ├── NavigationViewWithColumnsStyleTests.swift
│ │ │ ├── NavigationViewWithStackStyleTests.swift
│ │ │ ├── PageControlTests.swift
│ │ │ ├── PickerWithMenuStyleTests.swift
│ │ │ ├── PickerWithSegmentedStyleTests.swift
│ │ │ ├── PickerWithWheelStyleTests.swift
│ │ │ ├── PopoverTests.swift
│ │ │ ├── ProgressViewWithCircularStyleTests.swift
│ │ │ ├── ProgressViewWithLinearStyleTests.swift
│ │ │ ├── ScrollViewTests.swift
│ │ │ ├── SearchFieldTests.swift
│ │ │ ├── SecureFieldTests.swift
│ │ │ ├── SheetTests.swift
│ │ │ ├── SliderTests.swift
│ │ │ ├── StepperTests.swift
│ │ │ ├── TabViewTests.swift
│ │ │ ├── TabViewWithPageStyleTests.swift
│ │ │ ├── TableTests.swift
│ │ │ ├── TextEditorTests.swift
│ │ │ ├── TextFieldTests.swift
│ │ │ ├── TextFieldWithVerticalAxisTests.swift
│ │ │ ├── ToggleTests.swift
│ │ │ ├── ToggleWithButtonStyleTests.swift
│ │ │ ├── ToggleWithCheckboxStyleTests.swift
│ │ │ ├── ToggleWithSwitchStyleTests.swift
│ │ │ ├── VideoPlayerTests.swift
│ │ │ ├── ViewControllerTests.swift
│ │ │ ├── ViewTests.swift
│ │ │ ├── WebViewTests.swift
│ │ │ └── WindowTests.swift
│ │ └── WeakTests.swift
│ ├── Tests.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ ├── SwiftUIIntrospectTestFramework.xcscheme
│ │ └── SwiftUIIntrospectTests.xcscheme
│ ├── Tests.xctestplan
│ └── TestsHostApp/
│ ├── App.swift
│ └── Assets.xcassets/
│ ├── AccentColor.colorset/
│ │ └── Contents.json
│ ├── AppIcon.appiconset/
│ │ └── Contents.json
│ └── Contents.json
└── script/
└── pod_release
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# EditorConfig is awesome: https://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
[*.swift]
indent_style = tab
[*.md]
indent_style = space
indent_size = 4
[*.json]
indent_style = tab
[*.yml]
indent_style = space
indent_size = 4
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug Report
description: Something isn't working as expected
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thank you for contributing to SwiftUI Introspect!
Before you submit your issue, please complete each text area below with the relevant details for your bug, and complete the steps in the checklist.
- type: textarea
attributes:
label: Description
description: |
A short description of the incorrect behavior.
If you think this issue has been recently introduced and did not occur in an earlier version, please note that. If possible, include the last version that the behavior was correct in addition to your current version.
validations:
required: true
- type: checkboxes
attributes:
label: Checklist
options:
- label: I have read the [README](https://github.com/siteline/swiftui-introspect#swiftui-introspect) before submitting this report.
required: true
- label: This issue hasn't been addressed in an [existing GitHub issue](https://github.com/siteline/swiftui-introspect/issues) or [discussion](https://github.com/siteline/swiftui-introspect/discussions).
required: true
- type: textarea
attributes:
label: Expected behavior
description: Describe what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Actual behavior
description: Describe or copy/paste the behavior you observe.
validations:
required: false
- type: textarea
attributes:
label: Steps to reproduce
description: |
Explanation of how to reproduce the incorrect behavior.
This could include an attached project or link to code that is exhibiting the issue, and/or a screen recording.
Please make sure the code you are sharing is minimal and can be run independently of your project, otherwise it may be difficult to debug and will take longer to fix.
placeholder: |
1. ...
validations:
required: false
- type: input
attributes:
label: Version information
description: The version of SwiftUIIntrospect used to reproduce this issue.
placeholder: "'0.11.0' for example, or a commit hash"
- type: input
attributes:
label: Destination operating system
description: The OS running the SwiftUIIntrospect module.
placeholder: "'iOS 17' for example"
- type: input
attributes:
label: Xcode version information
description: The version of Xcode used to reproduce this issue.
placeholder: "The version displayed from 'Xcode 〉About Xcode'"
- type: textarea
attributes:
label: Swift Compiler version information
description: The version of Swift used to reproduce this issue.
placeholder: Output from 'xcrun swiftc --version'
render: shell
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Project Discussion
url: https://github.com/siteline/swiftui-introspect/discussions
about: Q&A, ideas, and more
- name: Documentation
url: https://github.com/siteline/swiftui-introspect#swiftui-introspect
about: Read SwiftUI Introspect's documentation
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- "**"
schedule:
- cron: "3 3 * * 2" # 3:03 AM, every Tuesday
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# TODO: Re-enable when --ifdef no-indent works as intended
# lint:
# name: Lint
# runs-on: macos-latest
# steps:
# - name: Git Checkout
# uses: actions/checkout@v5
# - name: Install SwiftFormat
# run: |
# brew unlink swiftformat
# brew install swiftformat --HEAD
# - name: SwiftFormat Lint
# run: swiftformat --lint . --reporter github-actions-log
lint-podspec:
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.title, '[skip ci]')
name: Lint Podspec
runs-on: macos-26
steps:
- name: Git Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0 # required to be able to find Git tags
- name: Select Xcode
run: sudo xcodes select 26.3
- name: Install Runtimes
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
command: xcodebuild -downloadAllPlatforms
- name: Lint Podspec
run: |
set -eo pipefail
export LIB_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
pod lib lint SwiftUIIntrospect.podspec --allow-warnings --skip-tests
ci:
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.title, '[skip ci]')
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner || 'macos-26' }}
strategy:
fail-fast: false
matrix:
include:
# iOS (iPhone)
- { name: "iOS 15.5", runtime: "iOS 15.5", device: "iPhone 13 Pro" }
- { name: "iOS 16.4", runtime: "iOS 16.4", device: "iPhone 14 Pro" }
- { name: "iOS 17.5", runtime: "iOS 17.5", device: "iPhone 15 Pro" }
- { name: "iOS 18.5", runtime: "iOS 18.5", device: "iPhone 16 Pro", runner: macos-15 }
- { name: "iOS 26.2", runtime: "iOS 26.2", device: "iPhone 17 Pro" }
# iPadOS
- { name: "iPadOS 15.5", runtime: "iOS 15.5", device: "iPad Pro (11-inch) (3rd generation)" }
- { name: "iPadOS 16.4", runtime: "iOS 16.4", device: "iPad Pro (11-inch) (4th generation)" }
- { name: "iPadOS 17.5", runtime: "iOS 17.5", device: "iPad Pro 11-inch (M4)" }
- { name: "iPadOS 18.5", runtime: "iOS 18.5", device: "iPad Pro 11-inch (M4)", runner: macos-15 }
- { name: "iPadOS 26.0", runtime: "iOS 26.0", device: "iPad Pro 11-inch (M4)" }
# macOS / macCatalyst
- { name: "macCatalyst 15", destination: "platform=macOS,variant=Mac Catalyst", runner: macos-15 }
- { name: "macCatalyst 26", destination: "platform=macOS,variant=Mac Catalyst" }
- { name: "macOS 15", destination: "platform=macOS", runner: macos-15 }
- { name: "macOS 26", destination: "platform=macOS" }
# tvOS
- { name: "tvOS 15.4", runtime: "tvOS 15.4", device: "Apple TV" }
- { name: "tvOS 16.4", runtime: "tvOS 16.4", device: "Apple TV" }
- { name: "tvOS 17.5", runtime: "tvOS 17.5", device: "Apple TV" }
- { name: "tvOS 18.5", runtime: "tvOS 18.5", device: "Apple TV", runner: macos-15 }
- { name: "tvOS 26.2", runtime: "tvOS 26.2", device: "Apple TV" }
# visionOS
- { name: "visionOS 1.2", runtime: "visionOS 1.2", device: "Apple Vision Pro (at 2732x2048)" }
- { name: "visionOS 2.5", runtime: "visionOS 2.5", device: "Apple Vision Pro (at 2732x2048)", runner: macos-15 }
- { name: "visionOS 26.2", runtime: "visionOS 26.2", device: "Apple Vision Pro" }
# watchOS (build-only, no test support)
- { name: "watchOS 8.5", runtime: "watchOS 8.5", device: "Apple Watch Series 7 (45mm)", build_only: true }
- { name: "watchOS 9.4", runtime: "watchOS 9.4", device: "Apple Watch Series 8 (45mm)", build_only: true }
- { name: "watchOS 10.5", runtime: "watchOS 10.5", device: "Apple Watch Series 9 (45mm)", build_only: true }
- { name: "watchOS 11.5", runtime: "watchOS 11.5", device: "Apple Watch Series 10 (42mm)", build_only: true, runner: macos-15 }
- { name: "watchOS 26.2", runtime: "watchOS 26.2", device: "Apple Watch Series 11 (42mm)", build_only: true }
steps:
- name: Git Checkout
uses: actions/checkout@v5
- name: Select Xcode
run: sudo xcodes select 26.3
- name: Install ${{ matrix.runtime }} Runtime
if: matrix.runtime
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: |
RUNTIME="${{ matrix.runtime }}"
if ! xcodes runtimes 2>/dev/null | grep -qF "$RUNTIME (Installed)"; then
sudo xcodes runtimes install "$RUNTIME" --aria2 $(which aria2c)
fi
- name: Create Simulator
if: matrix.device
run: |
set -eo pipefail
xcrun simctl delete all
# Look up runtime identifier by display name (handles internal names like xrOS for visionOS)
RUNTIME="${{ matrix.runtime }}"
RUNTIME_ID=$(xcrun simctl list runtimes -j | jq -r --arg name "$RUNTIME" '.runtimes[] | select(.isAvailable) | select(.name == $name) | .identifier')
if [ -z "$RUNTIME_ID" ] || [ "$RUNTIME_ID" = "null" ]; then
echo "::error::Runtime '$RUNTIME' not found. Available:"
xcrun simctl list runtimes
exit 1
fi
echo "Runtime: $RUNTIME_ID"
# Look up device type by display name, with fallback identifier construction
DEVICE_TYPE=$(xcrun simctl list devicetypes -j | jq -r --arg name "${{ matrix.device }}" '.devicetypes[] | select(.name == $name) | .identifier')
if [ -z "$DEVICE_TYPE" ] || [ "$DEVICE_TYPE" = "null" ]; then
DEVICE_TYPE="com.apple.CoreSimulator.SimDeviceType.$(echo "${{ matrix.device }}" | sed 's/[()]//g; s/ */-/g; s/[^A-Za-z0-9-]//g')"
echo "Device type not found by name, using fallback: $DEVICE_TYPE"
fi
UDID=$(xcrun simctl create "${{ matrix.device }}" "$DEVICE_TYPE" "$RUNTIME_ID")
echo "SIM_UDID=$UDID" >> "$GITHUB_ENV"
echo "Created simulator: ${{ matrix.device }} -> $UDID"
- name: Build Showcase
if: ${{ !matrix.build_only }}
run: |
set -eo pipefail
xcodebuild build \
-scheme Showcase \
-destination "${{ matrix.destination || format('id={0}', env.SIM_UDID) }}" \
-configuration Debug \
| xcbeautify
- name: Build Library
if: ${{ matrix.build_only == true }}
run: |
set -eo pipefail
xcodebuild build \
-scheme SwiftUIIntrospect \
-destination "id=${{ env.SIM_UDID }}" \
-configuration Debug \
| xcbeautify
- name: Run Tests
if: ${{ !matrix.build_only }}
run: |
set -eo pipefail
xcodebuild test \
-scheme SwiftUIIntrospectTests \
-destination "${{ matrix.destination || format('id={0}', env.SIM_UDID) }}" \
-configuration Debug \
| xcbeautify
framework-archiving:
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.title, '[skip ci]')
name: Archive Framework (${{ matrix.platform }})
runs-on: macos-26
strategy:
fail-fast: false
matrix:
include:
- { platform: iOS, destination: "generic/platform=iOS" }
- { platform: macCatalyst, destination: "platform=macOS,variant=Mac Catalyst" }
- { platform: macOS, destination: "generic/platform=macOS" }
- { platform: tvOS, destination: "generic/platform=tvOS" }
- { platform: visionOS, destination: "generic/platform=visionOS" }
- { platform: watchOS, destination: "generic/platform=watchOS" }
steps:
- name: Git Checkout
uses: actions/checkout@v5
- name: Select Xcode
run: sudo xcodes select 26.3
- name: Archive Framework
run: |
xcodebuild archive \
-scheme SwiftUIIntrospectTestFramework \
-destination "${{ matrix.destination }}" \
-archivePath .build/archiving/${{ matrix.platform }} \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
================================================
FILE: .gitignore
================================================
.DS_Store
/.build
/.swiftpm
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.netrc
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
================================================
FILE: .spi.yml
================================================
version: 1
builder:
configs:
- documentation_targets: [SwiftUIIntrospect]
================================================
FILE: .swift-version
================================================
6.0
================================================
FILE: .swiftformat
================================================
# SwiftFormat Configuration File
# For documentation, see: https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md
--header ignore
--indent tab
--ifdef no-indent
--ranges preserve
--extensionacl on-declarations
--trailing-commas always
--nil-init insert
--import-grouping testable-last
--wrap-conditions before-first
--guard-else next-line
# Disabled rules
--disable blankLinesAroundMark
--disable blankLinesBetweenScopes
--disable docComments
--disable redundantBackticks
--disable redundantLetError
--disable redundantRawValues
--disable redundantSelf
--disable redundantStaticSelf
--disable redundantType
--disable redundantTypedThrows
--disable redundantViewBuilder
--disable unusedArguments
--disable wrapFunctionBodies
--disable wrapPropertyBodies
================================================
FILE: Examples/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
================================================
FILE: Examples/Package.swift
================================================
// swift-tools-version:5.4
import PackageDescription
let package = Package(
name: "Examples",
products: [],
targets: []
)
================================================
FILE: Examples/Showcase/Showcase/App.swift
================================================
import SwiftUI
@main
struct App: SwiftUI.App {
var body: some Scene {
WindowGroup {
AppView()
}
}
}
#Preview {
AppView()
}
================================================
FILE: Examples/Showcase/Showcase/AppView.swift
================================================
import SwiftUI
import SwiftUIIntrospect
struct AppView: View {
var body: some View {
ContentView()
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.window,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { window in
window.backgroundColor = .brown
}
#elseif os(macOS)
.introspect(.window, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { window in
window.backgroundColor = .lightGray
}
#endif
}
}
struct ContentView: View {
@State var selection = 0
var body: some View {
TabView(selection: $selection) {
ListShowcase()
.tabItem { Label("List", systemImage: "1.circle") }
.tag(0)
ScrollViewShowcase()
.tabItem { Label("ScrollView", systemImage: "2.circle") }
.tag(1)
#if !os(macOS)
NavigationShowcase()
.tabItem { Label("Navigation", systemImage: "3.circle") }
.tag(2)
PresentationShowcase()
.tabItem { Label("Presentation", systemImage: "4.circle") }
.tag(3)
#endif
ControlsShowcase()
.tabItem { Label("Controls", systemImage: "5.circle") }
.tag(4)
UIViewRepresentableShowcase()
.tabItem { Label("UIViewRepresentable", systemImage: "6.circle") }
.tag(5)
}
#if os(iOS) || os(tvOS)
.introspect(.tabView, on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26)) { tabBarController in
if #available(iOS 26, macOS 26, tvOS 26, *) {
tabBarController.tabBar.backgroundColor = .green
} else {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = .green
tabBarController.tabBar.standardAppearance = appearance
tabBarController.tabBar.scrollEdgeAppearance = appearance
}
}
#elseif os(macOS)
.introspect(.tabView, on: .macOS(.v12, .v13, .v14)) { splitView in
splitView.subviews.first?.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
}
}
#Preview {
AppView()
}
================================================
FILE: Examples/Showcase/Showcase/Controls.swift
================================================
import SwiftUI
import SwiftUIIntrospect
struct ControlsShowcase: View {
@State private var textFieldValue = ""
@State private var toggleValue = false
@State private var sliderValue = 0.0
@State private var datePickerValue = Date()
@State private var segmentedControlValue = 0
var body: some View {
VStack {
HStack {
TextField("Text Field Red", text: $textFieldValue)
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.textField,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { textField in
textField.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { textField in
textField.backgroundColor = .red
}
#endif
TextField("Text Field Green", text: $textFieldValue)
.cornerRadius(8)
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.textField,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { textField in
textField.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { textField in
textField.backgroundColor = .green
}
#endif
}
#if !os(tvOS)
#if !os(visionOS)
HStack {
Toggle("Toggle Red", isOn: $toggleValue)
#if os(iOS)
.introspect(
.toggle,
on: .iOS(.v15, .v16, .v17, .v18, .v26)
) { toggle in
toggle.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.toggle, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { toggle in
toggle.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
Toggle("Toggle Green", isOn: $toggleValue)
#if os(iOS)
.introspect(
.toggle,
on: .iOS(.v15, .v16, .v17, .v18, .v26)
) { toggle in
toggle.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.toggle, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { toggle in
toggle.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
}
#if !targetEnvironment(macCatalyst)
HStack {
Slider(value: $sliderValue, in: 0...100)
#if os(iOS)
.introspect(.slider, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { slider in
slider.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.slider, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { slider in
slider.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
Slider(value: $sliderValue, in: 0...100)
#if os(iOS)
.introspect(.slider, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { slider in
slider.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.slider, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { slider in
slider.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
}
#endif
HStack {
Stepper(onIncrement: {}, onDecrement: {}) {
Text("Stepper Red")
}
#if os(iOS)
.introspect(.stepper, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { stepper in
stepper.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.stepper, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { stepper in
stepper.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
Stepper(onIncrement: {}, onDecrement: {}) {
Text("Stepper Green")
}
#if os(iOS)
.introspect(.stepper, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { stepper in
stepper.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.stepper, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { stepper in
stepper.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
}
#endif
HStack {
DatePicker(selection: $datePickerValue) {
Text("DatePicker Red")
}
#if os(iOS) || os(visionOS)
.introspect(.datePicker, on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { datePicker in
datePicker.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.datePicker, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { datePicker in
datePicker.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
}
#endif
HStack {
Picker(selection: $segmentedControlValue, label: Text("Segmented control")) {
Text("Option 1").tag(0)
Text("Option 2").tag(1)
Text("Option 3").tag(2)
}
.pickerStyle(SegmentedPickerStyle())
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.picker(style: .segmented),
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { datePicker in
datePicker.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.picker(style: .segmented), on: .macOS(.v12, .v13, .v14, .v15, .v26)) { datePicker in
datePicker.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
}
}
}
}
================================================
FILE: Examples/Showcase/Showcase/Helpers.swift
================================================
import SwiftUI
extension View {
/// Modify a view with a `ViewBuilder` closure.
///
/// This represents a streamlining of the
/// [`modifier`](https://developer.apple.com/documentation/swiftui/view/modifier(_:)) +
/// [`ViewModifier`](https://developer.apple.com/documentation/swiftui/viewmodifier) pattern.
///
/// - Note: Useful only when you don't need to reuse the closure.
/// If you do, turn the closure into a proper modifier.
public func modifier<ModifiedContent: View>(
@ViewBuilder _ modifier: (Self) -> ModifiedContent
) -> ModifiedContent {
modifier(self)
}
}
================================================
FILE: Examples/Showcase/Showcase/List.swift
================================================
import SwiftUI
import SwiftUIIntrospect
struct ListShowcase: View {
@State var receiverListFound: Bool = false
@State var ancestorListFound: Bool = false
var body: some View {
VStack(spacing: 40) {
VStack {
Text("Default")
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.horizontal, 12)
List {
Text("Item 1")
Text("Item 2")
}
}
VStack {
Text(".introspect(.list, ...)")
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.horizontal, 12)
.font(.system(.subheadline, design: .monospaced))
List {
Text("Item 1")
Text("Item 2")
}
.modifier { list in
if #available(iOS 16, macOS 13, *) {
list.background {
if receiverListFound {
Color(.cyan)
}
}
#if !os(tvOS)
.scrollContentBackground(.hidden)
#endif
} else {
list
}
}
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(.list, on: .iOS(.v15), .tvOS(.v15, .v16, .v17, .v18, .v26)) { tableView in
tableView.backgroundView = UIView()
tableView.backgroundColor = .cyan
}
.introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { collectionView in
DispatchQueue.main.async {
receiverListFound = true
}
}
#elseif os(macOS)
.introspect(.list, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { tableView in
DispatchQueue.main.async {
receiverListFound = true
}
}
#endif
}
VStack {
Text(".introspect(.list, ..., scope: .ancestor)")
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.horizontal, 12)
.font(.system(.subheadline, design: .monospaced))
List {
Text("Item 1")
Text("Item 2")
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(.list, on: .iOS(.v15), .tvOS(.v15, .v16, .v17, .v18, .v26), scope: .ancestor) { tableView in
tableView.backgroundView = UIView()
tableView.backgroundColor = .cyan
}
.introspect(.list, on: .iOS(.v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26), scope: .ancestor) { collectionView in
DispatchQueue.main.async {
ancestorListFound = true
}
}
#elseif os(macOS)
.introspect(.list, on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor) { tableView in
DispatchQueue.main.async {
ancestorListFound = true
}
}
#endif
}
.modifier { list in
if #available(iOS 16, macOS 13, *) {
list.background {
if ancestorListFound {
Color(.cyan)
}
}
#if !os(tvOS)
.scrollContentBackground(.hidden)
#endif
} else {
list
}
}
}
}
}
}
================================================
FILE: Examples/Showcase/Showcase/Navigation.swift
================================================
import SwiftUI
import SwiftUIIntrospect
struct NavigationShowcase: View {
var body: some View {
NavigationView {
Text("Content")
.searchable(text: .constant(""))
#if os(iOS) || os(visionOS)
.navigationBarTitle(Text("Customized"), displayMode: .inline)
#elseif os(macOS)
.navigationTitle(Text("Navigation"))
#endif
}
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.navigationView(style: .stack),
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { navigationController in
navigationController.navigationBar.backgroundColor = .cyan
}
.introspect(
.navigationView(style: .columns),
on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { splitViewController in
#if os(visionOS)
splitViewController.preferredDisplayMode = .oneBesideSecondary
#else
splitViewController.preferredDisplayMode = .oneOverSecondary
#endif
}
.introspect(.navigationView(style: .columns), on: .tvOS(.v15, .v16, .v17, .v18, .v26)) { navigationController in
navigationController.navigationBar.backgroundColor = .cyan
}
.introspect(
.searchField,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { searchBar in
searchBar.backgroundColor = .red
#if os(iOS)
searchBar.searchTextField.backgroundColor = .purple
#endif
}
#endif
}
}
================================================
FILE: Examples/Showcase/Showcase/Presentation.swift
================================================
import SwiftUI
import SwiftUIIntrospect
#if !os(macOS)
struct PresentationShowcase: View {
@State var isSheetPresented = false
@State var isFullScreenPresented = false
@State var isPopoverPresented = false
var body: some View {
VStack(spacing: 20) {
Button("Sheet", action: { isSheetPresented = true })
.sheet(isPresented: $isSheetPresented) {
Button("Dismiss", action: { isSheetPresented = false })
#if os(iOS) || os(tvOS)
.introspect(
.sheet,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
#elseif os(visionOS)
.introspect(.sheet, on: .visionOS(.v1, .v2, .v26)) { sheetPresentationController in
sheetPresentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
#endif
}
Button("Full Screen Cover", action: { isFullScreenPresented = true })
.fullScreenCover(isPresented: $isFullScreenPresented) {
Button("Dismiss", action: { isFullScreenPresented = false })
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.fullScreenCover,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
#endif
}
#if os(iOS) || os(visionOS)
Button("Popover", action: { isPopoverPresented = true })
.popover(isPresented: $isPopoverPresented) {
Button("Dismiss", action: { isPopoverPresented = false })
.padding()
.introspect(
.popover,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
}
#endif
}
}
}
#endif
================================================
FILE: Examples/Showcase/Showcase/ScrollView.swift
================================================
import SwiftUI
import SwiftUIIntrospect
struct ScrollViewShowcase: View {
@State var receiverScrollViewFound: Bool = false
@State var ancestorScrollViewFound: Bool = false
var body: some View {
VStack(spacing: 40) {
ScrollView {
Text("Default")
.frame(maxWidth: .infinity)
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.horizontal, 12)
}
ScrollView {
Text(".introspect(.scrollView, ...)")
.frame(maxWidth: .infinity)
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.horizontal, 12)
.font(.system(.subheadline, design: .monospaced))
}
.background {
if receiverScrollViewFound {
Color(.cyan)
}
}
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.scrollView,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { _ in
DispatchQueue.main.async {
receiverScrollViewFound = true
}
}
#elseif os(macOS)
.introspect(.scrollView, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { scrollView in
DispatchQueue.main.async {
receiverScrollViewFound = true
}
}
#endif
ScrollView {
Text(".introspect(.scrollView, ..., scope: .ancestor)")
.frame(maxWidth: .infinity)
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.horizontal, 12)
.font(.system(.subheadline, design: .monospaced))
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.scrollView,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26),
scope: .ancestor
) { _ in
DispatchQueue.main.async {
ancestorScrollViewFound = true
}
}
#elseif os(macOS)
.introspect(.scrollView, on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor) { scrollView in
DispatchQueue.main.async {
ancestorScrollViewFound = true
}
}
#endif
}
.background {
if ancestorScrollViewFound {
Color(.cyan)
}
}
}
}
}
================================================
FILE: Examples/Showcase/Showcase/Showcase.entitlements
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
================================================
FILE: Examples/Showcase/Showcase/UIViewRepresentable.swift
================================================
import SwiftUI
@_spi(Internals) import SwiftUIIntrospect
struct UIViewRepresentableShowcase: View {
let colors: [Color] = [.red, .green, .blue]
var body: some View {
VStack(spacing: 10) {
ForEach(colors, id: \.self) { color in
GenericViewRepresentable()
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { view in
view.backgroundColor = UIColor(color)
}
#elseif os(macOS)
.introspect(.view, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { view in
view.layer?.backgroundColor = NSColor(color).cgColor
}
#endif
}
}
.padding()
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { view in
view.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.view, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { view in
view.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
}
}
@MainActor
struct GenericViewRepresentable: PlatformViewControllerRepresentable {
#if canImport(UIKit)
typealias UIViewControllerType = PlatformViewController
#elseif canImport(AppKit)
typealias NSViewControllerType = PlatformViewController
#endif
func makePlatformViewController(context: Context) -> PlatformViewController {
let controller = PlatformViewController(nibName: nil, bundle: nil)
controller.view.translatesAutoresizingMaskIntoConstraints = false
let widthConstraint = controller.view.widthAnchor.constraint(greaterThanOrEqualToConstant: .greatestFiniteMagnitude)
widthConstraint.priority = .defaultLow
let heightConstraint = controller.view.heightAnchor.constraint(greaterThanOrEqualToConstant: .greatestFiniteMagnitude)
heightConstraint.priority = .defaultLow
NSLayoutConstraint.activate([widthConstraint, heightConstraint])
return controller
}
func updatePlatformViewController(_ controller: PlatformViewController, context: Context) {
// NO-OP
}
static func dismantlePlatformViewController(_ controller: PlatformViewController, coordinator: Coordinator) {
// NO-OP
}
}
================================================
FILE: Examples/Showcase/Showcase.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 55;
objects = {
/* Begin PBXBuildFile section */
D53071F729983CEF00F1936C /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53071F629983CEF00F1936C /* App.swift */; };
D53071F929983CEF00F1936C /* AppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53071F829983CEF00F1936C /* AppView.swift */; };
D5B829752999738200920EBD /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B829742999738200920EBD /* Helpers.swift */; };
D5B864E82E72BF0F002F5243 /* ScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864E72E72BF0F002F5243 /* ScrollView.swift */; };
D5B864EA2E72CE71002F5243 /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864E92E72CE71002F5243 /* List.swift */; };
D5B864EC2E72D9E1002F5243 /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864EB2E72D9E1002F5243 /* Navigation.swift */; };
D5B864EE2E72DB42002F5243 /* Presentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864ED2E72DB42002F5243 /* Presentation.swift */; };
D5B864F02E72DC75002F5243 /* Controls.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864EF2E72DC75002F5243 /* Controls.swift */; };
D5B864F22E72DCA7002F5243 /* UIViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864F12E72DCA7002F5243 /* UIViewRepresentable.swift */; };
D5E3180329C132B6005847DC /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = D5E3180229C132B6005847DC /* SwiftUIIntrospect */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
D53071F329983CEF00F1936C /* Showcase.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Showcase.app; sourceTree = BUILT_PRODUCTS_DIR; };
D53071F629983CEF00F1936C /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
D53071F829983CEF00F1936C /* AppView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppView.swift; sourceTree = "<group>"; };
D530720429983D9300F1936C /* Showcase.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Showcase.entitlements; sourceTree = "<group>"; };
D5B829742999738200920EBD /* Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Helpers.swift; sourceTree = "<group>"; };
D5B864E72E72BF0F002F5243 /* ScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollView.swift; sourceTree = "<group>"; };
D5B864E92E72CE71002F5243 /* List.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = List.swift; sourceTree = "<group>"; };
D5B864EB2E72D9E1002F5243 /* Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Navigation.swift; sourceTree = "<group>"; };
D5B864ED2E72DB42002F5243 /* Presentation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Presentation.swift; sourceTree = "<group>"; };
D5B864EF2E72DC75002F5243 /* Controls.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Controls.swift; sourceTree = "<group>"; };
D5B864F12E72DCA7002F5243 /* UIViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewRepresentable.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
D53071F029983CEF00F1936C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D5E3180329C132B6005847DC /* SwiftUIIntrospect in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
D53071EA29983CEF00F1936C = {
isa = PBXGroup;
children = (
D53071F529983CEF00F1936C /* Showcase */,
D53071F429983CEF00F1936C /* Products */,
D530720529983DCA00F1936C /* Frameworks */,
);
sourceTree = "<group>";
};
D53071F429983CEF00F1936C /* Products */ = {
isa = PBXGroup;
children = (
D53071F329983CEF00F1936C /* Showcase.app */,
);
name = Products;
sourceTree = "<group>";
};
D53071F529983CEF00F1936C /* Showcase */ = {
isa = PBXGroup;
children = (
D530720429983D9300F1936C /* Showcase.entitlements */,
D53071F629983CEF00F1936C /* App.swift */,
D53071F829983CEF00F1936C /* AppView.swift */,
D5B864E92E72CE71002F5243 /* List.swift */,
D5B864E72E72BF0F002F5243 /* ScrollView.swift */,
D5B864EB2E72D9E1002F5243 /* Navigation.swift */,
D5B864ED2E72DB42002F5243 /* Presentation.swift */,
D5B864EF2E72DC75002F5243 /* Controls.swift */,
D5B864F12E72DCA7002F5243 /* UIViewRepresentable.swift */,
D5B829742999738200920EBD /* Helpers.swift */,
);
path = Showcase;
sourceTree = "<group>";
};
D530720529983DCA00F1936C /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
D53071F229983CEF00F1936C /* Showcase */ = {
isa = PBXNativeTarget;
buildConfigurationList = D530720129983CF000F1936C /* Build configuration list for PBXNativeTarget "Showcase" */;
buildPhases = (
D53071EF29983CEF00F1936C /* Sources */,
D53071F029983CEF00F1936C /* Frameworks */,
D53071F129983CEF00F1936C /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = Showcase;
packageProductDependencies = (
D5E3180229C132B6005847DC /* SwiftUIIntrospect */,
);
productName = Showcase;
productReference = D53071F329983CEF00F1936C /* Showcase.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
D53071EB29983CEF00F1936C /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 2600;
TargetAttributes = {
D53071F229983CEF00F1936C = {
CreatedOnToolsVersion = 14.2;
};
};
};
buildConfigurationList = D53071EE29983CEF00F1936C /* Build configuration list for PBXProject "Showcase" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D53071EA29983CEF00F1936C;
productRefGroup = D53071F429983CEF00F1936C /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
D53071F229983CEF00F1936C /* Showcase */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
D53071F129983CEF00F1936C /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
D53071EF29983CEF00F1936C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D53071F929983CEF00F1936C /* AppView.swift in Sources */,
D5B864EE2E72DB42002F5243 /* Presentation.swift in Sources */,
D5B864F22E72DCA7002F5243 /* UIViewRepresentable.swift in Sources */,
D5B864E82E72BF0F002F5243 /* ScrollView.swift in Sources */,
D5B829752999738200920EBD /* Helpers.swift in Sources */,
D5B864EC2E72D9E1002F5243 /* Navigation.swift in Sources */,
D5B864F02E72DC75002F5243 /* Controls.swift in Sources */,
D5B864EA2E72CE71002F5243 /* List.swift in Sources */,
D53071F729983CEF00F1936C /* App.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
D53071FF29983CF000F1936C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvsimulator appletvos";
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TVOS_DEPLOYMENT_TARGET = 15.0;
WATCHOS_DEPLOYMENT_TARGET = 8.0;
XROS_DEPLOYMENT_TARGET = 1.0;
};
name = Debug;
};
D530720029983CF000F1936C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MACOSX_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvsimulator appletvos";
SUPPORTS_MACCATALYST = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TVOS_DEPLOYMENT_TARGET = 15.0;
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 8.0;
XROS_DEPLOYMENT_TARGET = 1.0;
};
name = Release;
};
D530720229983CF000F1936C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Showcase/Showcase.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
ENABLE_APP_SANDBOX = YES;
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.siteline.Showcase;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,6,7";
};
name = Debug;
};
D530720329983CF000F1936C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Showcase/Showcase.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
ENABLE_APP_SANDBOX = YES;
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.siteline.Showcase;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,6,7";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
D53071EE29983CEF00F1936C /* Build configuration list for PBXProject "Showcase" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D53071FF29983CF000F1936C /* Debug */,
D530720029983CF000F1936C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D530720129983CF000F1936C /* Build configuration list for PBXNativeTarget "Showcase" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D530720229983CF000F1936C /* Debug */,
D530720329983CF000F1936C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCSwiftPackageProductDependency section */
D5E3180229C132B6005847DC /* SwiftUIIntrospect */ = {
isa = XCSwiftPackageProductDependency;
productName = SwiftUIIntrospect;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = D53071EB29983CEF00F1936C /* Project object */;
}
================================================
FILE: Examples/Showcase/Showcase.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
================================================
FILE: Examples/Showcase/Showcase.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
================================================
FILE: Examples/Showcase/Showcase.xcodeproj/xcshareddata/xcschemes/Showcase.xcscheme
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D53071F229983CEF00F1936C"
BuildableName = "Showcase.app"
BlueprintName = "Showcase"
ReferencedContainer = "container:Showcase.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D53071F229983CEF00F1936C"
BuildableName = "Showcase.app"
BlueprintName = "Showcase"
ReferencedContainer = "container:Showcase.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D53071F229983CEF00F1936C"
BuildableName = "Showcase.app"
BlueprintName = "Showcase"
ReferencedContainer = "container:Showcase.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
================================================
FILE: LICENSE
================================================
Copyright 2019 Timber Software
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: Package.swift
================================================
// swift-tools-version:6.0
import PackageDescription
let package = Package(
name: "swiftui-introspect",
platforms: [
.iOS(.v13),
.macCatalyst(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.visionOS(.v1),
],
products: [
.library(name: "SwiftUIIntrospect", targets: ["SwiftUIIntrospect"]),
.library(name: "SwiftUIIntrospect-Static", type: .static, targets: ["SwiftUIIntrospect"]),
.library(name: "SwiftUIIntrospect-Dynamic", type: .dynamic, targets: ["SwiftUIIntrospect"]),
],
targets: [
.target(
name: "SwiftUIIntrospect",
path: "Sources"
),
]
)
for target in package.targets {
target.swiftSettings = target.swiftSettings ?? []
target.swiftSettings? += [
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("InternalImportsByDefault"),
]
}
================================================
FILE: README.md
================================================
SwiftUI Introspect
=================
[](https://github.com/siteline/swiftui-introspect/actions/workflows/ci.yml)
[](https://swiftpackageindex.com/siteline/swiftui-introspect)
[](https://swiftpackageindex.com/siteline/swiftui-introspect)
SwiftUI Introspect lets you access the underlying UIKit or AppKit view for a SwiftUI view.
- [How it works](#how-it-works)
- [Install](#install)
- [Swift Package Manager](#swift-package-manager)
- [CocoaPods](#cocoapods)
- [View Types](#view-types)
- [Examples](#examples)
- [General Guidelines](#general-guidelines)
- [Advanced usage](#advanced-usage)
- [Implement your own introspectable type](#implement-your-own-introspectable-type)
- [Introspect on future platform versions](#introspect-on-future-platform-versions)
- [Keep instances outside the customize closure](#keep-instances-outside-the-customize-closure)
- [Note for library authors](#note-for-library-authors)
- [Community projects](#community-projects)
How it works
------------
SwiftUI Introspect adds an invisible `IntrospectionView` above the selected view and an invisible anchor below it, then searches the UIKit/AppKit view hierarchy between them to find the relevant view.
For instance, when introspecting a `ScrollView`...
```swift
ScrollView {
Text("Item 1")
}
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { scrollView in
// do something with UIScrollView
}
```
... it will:
1. Add marker views before and after `ScrollView`.
2. Traverse through all subviews between both marker views until a `UIScrollView` instance (if any) is found.
> [!IMPORTANT]
> Although this method is solid and unlikely to break on its own, future OS releases require explicit opt in for introspection (`.iOS(.vXYZ)`) because underlying UIKit/AppKit types can change between major versions.
By default, `.introspect` acts on its receiver. Calling `.introspect` from inside the view you want to introspect has no effect. If you need to introspect an ancestor instead, set `scope: .ancestor`:
```swift
ScrollView {
Text("Item 1")
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { scrollView in
// do something with UIScrollView
}
}
```
### Usage in production
SwiftUI Introspect is suitable for production. It does not use private APIs. It inspects the view hierarchy using public methods and takes a defensive approach: it makes no hard layout assumptions, performs no forced casts to UIKit/AppKit classes, and ignores `.introspect` when the expected UIKit/AppKit view cannot be found.
Install
-------
### Swift Package Manager
#### Xcode
<img width="660" height="300" src="https://github.com/user-attachments/assets/ab1c1a62-96d9-417d-ad2b-43012a69cae8" />
#### Package.swift
```swift
let package = Package(
dependencies: [
.package(url: "https://github.com/siteline/swiftui-introspect", from: "26.0.0"),
],
targets: [
.target(name: <#Target Name#>, dependencies: [
.product(name: "SwiftUIIntrospect", package: "swiftui-introspect"),
]),
]
)
```
### CocoaPods
```ruby
pod 'SwiftUIIntrospect', '~> 26.0.0'
```
View Types
----------
### Implemented
- [`Button`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/buttontype)
- [`ColorPicker`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/colorpickertype)
- [`DatePicker`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/datepickertype)
- [`DatePicker` with `.compact` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/datepickerwithcompactstyletype)
- [`DatePicker` with `.field` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/datepickerwithfieldstyletype)
- [`DatePicker` with `.graphical` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/datepickerwithgraphicalstyletype)
- [`DatePicker` with `.stepperField` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/datepickerwithstepperfieldstyletype)
- [`DatePicker` with `.wheel` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/datepickerwithwheelstyletype)
- [`Form`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/formtype)
- [`Form` with `.grouped` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/formwithgroupedstyletype)
- [`.fullScreenCover`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/fullScreenCovertype)
- [`List`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/listtype)
- [`List` with `.bordered` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/listwithborderedstyletype)
- [`List` with `.grouped` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/listwithgroupedstyletype)
- [`List` with `.insetGrouped` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/listwithinsetgroupedstyletype)
- [`List` with `.inset` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/listwithinsetstyletype)
- [`List` with `.sidebar` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/listwithsidebarstyletype)
- [`ListCell`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/listcelltype)
- [`Map`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/maptype)
- [`NavigationSplitView`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/navigationsplitviewtype)
- [`NavigationStack`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/navigationstacktype)
- [`NavigationView` with `.columns` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/NavigationViewWithColumnsStyleType)
- [`NavigationView` with `.stack` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/NavigationViewWithStackStyleType)
- [`PageControl`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/pagecontroltype)
- [`Picker` with `.menu` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/pickerwithmenustyletype)
- [`Picker` with `.segmented` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/pickerwithsegmentedstyletype)
- [`Picker` with `.wheel` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/pickerwithwheelstyletype)
- [`.popover`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/popovertype)
- [`ProgressView` with `.circular` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/progressviewwithcircularstyletype)
- [`ProgressView` with `.linear` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/progressviewwithlinearstyletype)
- [`ScrollView`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/scrollviewtype)
- [`.searchable`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/searchfieldtype)
- [`SecureField`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/securefieldtype)
- [`.sheet`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/sheettype)
- [`Slider`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/slidertype)
- [`Stepper`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/steppertype)
- [`Table`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/tabletype)
- [`TabView`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/tabviewtype)
- [`TabView` with `.page` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/TabViewWithPageStyleType)
- [`TextEditor`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/texteditortype)
- [`TextField`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/textfieldtype)
- [`TextField` with `.vertical` axis](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/TextFieldWithVerticalAxisType)
- [`Toggle`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/toggletype)
- [`Toggle` with `button` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/togglewithbuttonstyletype)
- [`Toggle` with `checkbox` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/togglewithcheckboxstyletype)
- [`Toggle` with `switch` style](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/togglewithswitchstyletype)
- [`VideoPlayer`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/videoplayertype)
- [`View`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/viewtype)
- [`ViewController`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/viewcontrollertype)
- [`WebView`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/webviewtype)
- [`Window`](https://swiftpackageindex.com/siteline/swiftui-introspect/main/documentation/swiftuiintrospect/windowtype)
**Missing an element?** Please [start a discussion](https://github.com/siteline/swiftui-introspect/discussions/new?category=ideas). As a temporary solution, you can [implement your own introspectable view type](#implement-your-own-introspectable-type).
### Cannot implement
SwiftUI | Affected Frameworks | Why
--- | --- | ---
Text | UIKit, AppKit | Not a UILabel / NSLabel
Image | UIKit, AppKit | Not a UIImageView / NSImageView
Button | UIKit | Not a UIButton
Link | UIKit, AppKit | Not a UIButton / NSButton
NavigationLink | UIKit | Not a UIButton
GroupBox | AppKit | No underlying view
Menu | UIKit, AppKit | No underlying view
Spacer | UIKit, AppKit | No underlying view
Divider | UIKit, AppKit | No underlying view
HStack, VStack, ZStack | UIKit, AppKit | No underlying view
LazyVStack, LazyHStack, LazyVGrid, LazyHGrid | UIKit, AppKit | No underlying view
Color | UIKit, AppKit | No underlying view
ForEach | UIKit, AppKit | No underlying view
GeometryReader | UIKit, AppKit | No underlying view
Chart | UIKit, AppKit | Native SwiftUI framework
Examples
--------
### List
```swift
List {
Text("Item")
}
.introspect(.list, on: .iOS(.v13, .v14, .v15)) { tableView in
tableView.bounces = false
}
.introspect(.list, on: .iOS(.v16, .v17, .v18, .v26)) { collectionView in
collectionView.bounces = false
}
```
### ScrollView
```swift
ScrollView {
Text("Item")
}
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { scrollView in
scrollView.bounces = false
}
```
### NavigationView
```swift
NavigationView {
Text("Item")
}
.navigationViewStyle(.stack)
.introspect(.navigationView(style: .stack), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { navigationController in
navigationController.navigationBar.backgroundColor = .cyan
}
```
### TextField
```swift
TextField("Text Field", text: <#Binding<String>#>)
.introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { textField in
textField.backgroundColor = .red
}
```
General Guidelines
------------------
Here are some guidelines to keep in mind when using SwiftUI Introspect:
- **Use sparingly**: prefer native SwiftUI modifiers when available. Use introspection only when you need underlying UIKit/AppKit APIs that SwiftUI does not expose.
- **Program defensively**: the introspection closure may be called multiple times during the view's lifecycle, such as during view updates or re-renders. Ensure that your customization code can handle being executed multiple times without causing unintended side effects.
- **Avoid direct state changes**: do not change SwiftUI state from inside the introspection closure. If you must update state, wrap it in `DispatchQueue.main.async`.
- **Test across OS versions**: underlying implementations can differ by OS, which can affect customization.
- **Avoid retain cycles**: be cautious about capturing `self` or other strong references within the introspection closure, as this can lead to memory leaks. Use `[weak self]` or `[unowned self]` capture lists as appropriate.
- **Scope**: `.introspect` targets its receiver by default. Use `scope: .ancestor` only when you need to introspect an ancestor. In general, you shouldn't worry about this as each view type has sensible, predictable default scopes.
Advanced usage
--------------
> [!NOTE]
> These features are advanced and unnecessary for most use cases. Use them when you need extra control or flexibility.
> [!IMPORTANT]
> To access these features, import SwiftUI Introspect using `@_spi(Advanced)` (see examples below).
### Implement your own introspectable type
**Missing an element?** Please [start a discussion](https://github.com/siteline/swiftui-introspect/discussions/new?category=ideas).
In the unlikely event SwiftUI Introspect does not support the element you need, you can implement your own introspectable type.
For example, here's how the library implements the introspectable `TextField` type:
```swift
import SwiftUI
@_spi(Advanced) import SwiftUIIntrospect
public struct TextFieldType: IntrospectableViewType {}
extension IntrospectableViewType where Self == TextFieldType {
public static var textField: Self { .init() }
}
#if canImport(UIKit)
extension iOSViewVersion<TextFieldType, UITextField> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<TextFieldType, UITextField> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<TextFieldType, UITextField> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
extension macOSViewVersion<TextFieldType, NSTextField> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
```
### Introspect on future platform versions
By default, introspection targets specific platform versions. This is an intentional design decision to maintain maximum predictability in actively maintained apps. However library authors may prefer to cover future versions to limit their commitment to regular maintenance without breaking client apps. For that, SwiftUI Introspect provides range-based version predicates via the Advanced SPI:
```swift
import SwiftUI
@_spi(Advanced) import SwiftUIIntrospect
struct ContentView: View {
var body: some View {
ScrollView {
// ...
}
.introspect(.scrollView, on: .iOS(.v13...)) { scrollView in
// ...
}
}
}
```
Use this cautiously. Future OS versions may change underlying types, in which case the customization closure will not run unless support is explicitly declared.
### Keep instances outside the customize closure
Sometimes you need to keep an introspected instance beyond the customization closure. `@State` is not appropriate for this, as it can create retain cycles. Instead, SwiftUI Introspect offers a `@Weak` property wrapper behind the Advanced SPI:
```swift
import SwiftUI
@_spi(Advanced) import SwiftUIIntrospect
struct ContentView: View {
@Weak var scrollView: UIScrollView?
var body: some View {
ScrollView {
// ...
}
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { scrollView in
self.scrollView = scrollView
}
}
}
```
Note for library authors
------------------------
If your library depends on SwiftUI Introspect, declare a version range that spans at least the **last two major versions** instead of jumping straight to the latest. This avoids conflicts when apps pull the library directly and through multiple dependencies. For example:
```swift
.package(url: "https://github.com/siteline/swiftui-introspect", "1.3.0"..<"27.0.0"),
```
A wider range is safe because SwiftUI Introspect is essentially “finished”: no new features will be added, only newer platform versions and view types. Thanks to [`@_spi(Advanced)` imports](https://github.com/siteline/swiftui-introspect#introspect-on-future-platform-versions), it is already future proof without frequent version bumps.
Community projects
------------------
Here are some popular open source libraries powered by SwiftUI Introspect:
- [CustomKeyboardKit](https://github.com/paescebu/CustomKeyboardKit)
- [swiftui-navigation-transitions](https://github.com/davdroman/swiftui-navigation-transitions)
- [PopupView](https://github.com/exyte/PopupView)
If you're working on a library built on SwiftUI Introspect or know of one, feel free to submit a PR adding it to the list.
================================================
FILE: Sources/Introspect.swift
================================================
#if !os(watchOS)
public import SwiftUI
/// The scope of introspection i.e. where introspect should look to find
/// the desired target view relative to the applied `.introspect(...)`
/// modifier.
public struct IntrospectionScope: OptionSet, Sendable {
/// Look within the `receiver` of the `.introspect(...)` modifier.
public static let receiver = Self(rawValue: 1 << 0)
/// Look for an `ancestor` relative to the `.introspect(...)` modifier.
public static let ancestor = Self(rawValue: 1 << 1)
@_spi(Internals) public let rawValue: UInt
@_spi(Internals) public init(rawValue: UInt) {
self.rawValue = rawValue
}
}
extension View {
/// Introspects a SwiftUI view to find its underlying UIKit/AppKit instance.
///
/// - Parameters:
/// - viewType: The type of view to be introspected.
/// - platforms: A list of version predicates that specify platform-specific entities associated with the view.
/// - scope: Optionally overrides the view's default scope of introspection.
/// - customize: A closure that hands over the underlying UIKit/AppKit instance ready for customization.
///
/// Note there is no guarantee of one-time execution for this closure. As `customize` may fire multiple times,
/// make sure to guard against repeated or heavy work in your closure by keeping track of its completeness.
///
/// Additionally, note mutating SwiftUI state within `customize` will trigger runtime warnings unless that mutation
/// is wrapped in a `DispatchQueue.main.async { ... }` call. This is because introspect attempts to hand you
/// the requested view as soon as possible, and this might mean SwiftUI isn't ready for state mutations at that
/// particular moment.
///
/// Here's an example usage:
///
/// ```swift
/// struct ContentView: View {
/// @State var text = ""
///
/// var body: some View {
/// TextField("Placeholder", text: $text)
/// .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UITextField
/// }
/// }
/// }
/// ```
@MainActor
public func introspect<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity>(
_ viewType: SwiftUIViewType,
on platforms: PlatformViewVersionPredicate<SwiftUIViewType, PlatformSpecificEntity>...,
scope: IntrospectionScope? = nil,
customize: @escaping (PlatformSpecificEntity) -> Void
) -> some View {
self.modifier(IntrospectModifier(viewType, platforms: platforms, scope: scope, customize: customize))
}
}
struct IntrospectModifier<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity>: ViewModifier {
let id = IntrospectionViewID()
let scope: IntrospectionScope
let selector: IntrospectionSelector<PlatformSpecificEntity>?
let customize: (PlatformSpecificEntity) -> Void
@MainActor
init(
_ viewType: SwiftUIViewType,
platforms: [PlatformViewVersionPredicate<SwiftUIViewType, PlatformSpecificEntity>],
scope: IntrospectionScope?,
customize: @escaping (PlatformSpecificEntity) -> Void
) {
self.scope = scope ?? viewType.scope
self.selector = platforms.lazy.compactMap(\.selector).first
self.customize = customize
}
func body(content: Content) -> some View {
if let selector {
content
.background(
Group {
// box up content for more accurate `.view` introspection
if SwiftUIViewType.self == ViewType.self {
Color.white
.opacity(0)
.accessibility(hidden: true)
}
}
)
.background(
IntrospectionAnchorView(id: id)
.frame(width: 0, height: 0)
.accessibility(hidden: true)
)
.overlay(
IntrospectionView(id: id, selector: { selector($0, scope) }, customize: customize)
.frame(width: 0, height: 0)
.accessibility(hidden: true)
)
} else {
content
}
}
}
@MainActor
public protocol PlatformEntity: AnyObject {
associatedtype Base: PlatformEntity
@_spi(Internals)
var ancestor: Base? { get }
@_spi(Internals)
var descendants: [Base] { get }
@_spi(Internals)
func isDescendant(of other: Base) -> Bool
}
extension PlatformEntity {
@_spi(Internals)
public var ancestor: Base? { nil }
@_spi(Internals)
public var descendants: [Base] { [] }
@_spi(Internals)
public func isDescendant(of other: Base) -> Bool { false }
}
extension PlatformEntity {
@_spi(Internals)
public var ancestors: some Sequence<Base> {
sequence(first: self~, next: { $0.ancestor~ }).dropFirst()
}
@_spi(Internals)
public var allDescendants: some Sequence<Base> {
recursiveSequence([self~], children: { $0.descendants~ }).dropFirst()
}
func nearestCommonAncestor(with other: Base) -> Base? {
var nearestAncestor: Base? = self~
while let currentEntity = nearestAncestor, !other.isDescendant(of: currentEntity~) {
nearestAncestor = currentEntity.ancestor~
}
return nearestAncestor
}
func allDescendants(between bottomEntity: Base, and topEntity: Base) -> some Sequence<Base> {
self.allDescendants
.lazy
.drop(while: { $0 !== bottomEntity })
.prefix(while: { $0 !== topEntity })
}
func receiver<PlatformSpecificEntity: PlatformEntity>(
ofType type: PlatformSpecificEntity.Type
) -> PlatformSpecificEntity? {
let frontEntity = self
guard
let backEntity = frontEntity.introspectionAnchorEntity,
let commonAncestor = backEntity.nearestCommonAncestor(with: frontEntity~)
else {
return nil
}
return commonAncestor
.allDescendants(between: backEntity~, and: frontEntity~)
.filter { !$0.isIntrospectionPlatformEntity }
.compactMap { $0 as? PlatformSpecificEntity }
.first
}
func ancestor<PlatformSpecificEntity: PlatformEntity>(
ofType type: PlatformSpecificEntity.Type
) -> PlatformSpecificEntity? {
self.ancestors
.lazy
.filter { !$0.isIntrospectionPlatformEntity }
.compactMap { $0 as? PlatformSpecificEntity }
.first
}
}
extension PlatformView: PlatformEntity {
@_spi(Internals)
public var ancestor: PlatformView? {
superview
}
@_spi(Internals)
public var descendants: [PlatformView] {
subviews
}
}
extension PlatformViewController: PlatformEntity {
@_spi(Internals)
public var ancestor: PlatformViewController? {
parent
}
@_spi(Internals)
public var descendants: [PlatformViewController] {
children
}
@_spi(Internals)
public func isDescendant(of other: PlatformViewController) -> Bool {
self.ancestors.contains(other)
}
}
#if canImport(UIKit)
extension UIPresentationController: PlatformEntity {
public typealias Base = UIPresentationController
}
#elseif canImport(AppKit)
extension NSWindow: PlatformEntity {
public typealias Base = NSWindow
}
#endif
#endif
================================================
FILE: Sources/IntrospectableViewType.swift
================================================
#if !os(watchOS)
@MainActor
public protocol IntrospectableViewType {
/// The scope of introspection for this particular view type, i.e. where introspect
/// should look to find the desired target view relative to the applied
/// `.introspect(...)` modifier.
///
/// While the scope can be overridden by the user in their `.introspect(...)` call,
/// most of the time it's preferable to defer to the view type's own scope,
/// as it guarantees introspection is working as intended by the vendor.
///
/// Defaults to `.receiver` if left unimplemented, which is a sensible one in
/// most cases if you're looking to implement your own view type.
var scope: IntrospectionScope { get }
}
extension IntrospectableViewType {
public var scope: IntrospectionScope { .receiver }
}
#endif
================================================
FILE: Sources/IntrospectionSelector.swift
================================================
#if !os(watchOS)
#if os(iOS) || os(tvOS) || os(visionOS)
public import UIKit
#elseif os(macOS)
public import AppKit
#endif
@_spi(Advanced)
@MainActor
public struct IntrospectionSelector<Target: PlatformEntity> {
@_spi(Advanced)
public static var `default`: Self { .from(Target.self, selector: { $0 }) }
@_spi(Advanced)
public static func from<Entry: PlatformEntity>(_ entryType: Entry.Type, selector: @MainActor @escaping (Entry) -> Target?) -> Self {
.init(
receiverSelector: { controller in
controller.as(Entry.Base.self)?.receiver(ofType: Entry.self).flatMap(selector)
},
ancestorSelector: { controller in
controller.as(Entry.Base.self)?.ancestor(ofType: Entry.self).flatMap(selector)
}
)
}
private var receiverSelector: @MainActor (IntrospectionPlatformViewController) -> Target?
private var ancestorSelector: @MainActor (IntrospectionPlatformViewController) -> Target?
private init(
receiverSelector: @MainActor @escaping (IntrospectionPlatformViewController) -> Target?,
ancestorSelector: @MainActor @escaping (IntrospectionPlatformViewController) -> Target?
) {
self.receiverSelector = receiverSelector
self.ancestorSelector = ancestorSelector
}
@_spi(Advanced)
public func withReceiverSelector(_ selector: @MainActor @escaping (PlatformViewController) -> Target?) -> Self {
var copy = self
copy.receiverSelector = selector
return copy
}
@_spi(Advanced)
public func withAncestorSelector(_ selector: @MainActor @escaping (PlatformViewController) -> Target?) -> Self {
var copy = self
copy.ancestorSelector = selector
return copy
}
func callAsFunction(_ controller: IntrospectionPlatformViewController, _ scope: IntrospectionScope) -> Target? {
if
scope.contains(.receiver),
let target = receiverSelector(controller)
{
return target
}
if
scope.contains(.ancestor),
let target = ancestorSelector(controller)
{
return target
}
return nil
}
}
extension PlatformViewController {
func `as`<Base: PlatformEntity>(_ baseType: Base.Type) -> (any PlatformEntity)? {
if Base.self == PlatformView.self {
#if canImport(UIKit)
return viewIfLoaded
#elseif canImport(AppKit)
return isViewLoaded ? view : nil
#endif
} else if Base.self == PlatformViewController.self {
return self
}
return nil
}
}
#endif
================================================
FILE: Sources/IntrospectionView.swift
================================================
#if !os(watchOS)
import SwiftUI
typealias IntrospectionViewID = UUID
@MainActor
fileprivate enum IntrospectionStore {
static var shared: [IntrospectionViewID: Pair] = [:]
struct Pair {
weak var controller: IntrospectionPlatformViewController? = nil
weak var anchor: IntrospectionAnchorPlatformViewController? = nil
}
}
extension PlatformEntity {
var introspectionAnchorEntity: Base? {
if let introspectionController = self as? IntrospectionPlatformViewController {
return IntrospectionStore.shared[introspectionController.id]?.anchor~
}
if
let view = self as? PlatformView,
let introspectionController = view.introspectionController
{
return IntrospectionStore.shared[introspectionController.id]?.anchor?.view~
}
return nil
}
}
/// ⚓️
struct IntrospectionAnchorView: PlatformViewControllerRepresentable {
#if canImport(UIKit)
typealias UIViewControllerType = IntrospectionAnchorPlatformViewController
#elseif canImport(AppKit)
typealias NSViewControllerType = IntrospectionAnchorPlatformViewController
#endif
@Binding
private var observed: Void // workaround for state changes not triggering view updates
let id: IntrospectionViewID
init(id: IntrospectionViewID) {
self._observed = .constant(())
self.id = id
}
func makePlatformViewController(context: Context) -> IntrospectionAnchorPlatformViewController {
IntrospectionAnchorPlatformViewController(id: id)
}
func updatePlatformViewController(_ controller: IntrospectionAnchorPlatformViewController, context: Context) {}
static func dismantlePlatformViewController(_ controller: IntrospectionAnchorPlatformViewController, coordinator: Coordinator) {}
}
final class IntrospectionAnchorPlatformViewController: PlatformViewController {
init(id: IntrospectionViewID) {
super.init(nibName: nil, bundle: nil)
self.isIntrospectionPlatformEntity = true
IntrospectionStore.shared[id, default: .init()].anchor = self
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
#if canImport(UIKit)
override func viewDidLoad() {
super.viewDidLoad()
view.isIntrospectionPlatformEntity = true
}
#elseif canImport(AppKit)
override func loadView() {
view = NSView()
view.isIntrospectionPlatformEntity = true
}
#endif
}
struct IntrospectionView<Target: PlatformEntity>: PlatformViewControllerRepresentable {
#if canImport(UIKit)
typealias UIViewControllerType = IntrospectionPlatformViewController
#elseif canImport(AppKit)
typealias NSViewControllerType = IntrospectionPlatformViewController
#endif
final class TargetCache {
weak var target: Target? = nil
}
@Binding
private var observed: Void // workaround for state changes not triggering view updates
private let id: IntrospectionViewID
private let selector: (IntrospectionPlatformViewController) -> Target?
private let customize: (Target) -> Void
init(
id: IntrospectionViewID,
selector: @escaping (IntrospectionPlatformViewController) -> Target?,
customize: @escaping (Target) -> Void
) {
self._observed = .constant(())
self.id = id
self.selector = selector
self.customize = customize
}
func makeCoordinator() -> TargetCache {
TargetCache()
}
func makePlatformViewController(context: Context) -> IntrospectionPlatformViewController {
IntrospectionPlatformViewController(id: id) { controller in
guard let target = selector(controller) else {
return
}
context.coordinator.target = target
customize(target)
controller.handler = nil
}
}
func updatePlatformViewController(_ controller: IntrospectionPlatformViewController, context: Context) {
guard let target = context.coordinator.target ?? selector(controller) else {
return
}
customize(target)
}
static func dismantlePlatformViewController(_ controller: IntrospectionPlatformViewController, coordinator: Coordinator) {
controller.handler = nil
IntrospectionStore.shared.removeValue(forKey: controller.id)
}
}
final class IntrospectionPlatformViewController: PlatformViewController {
let id: IntrospectionViewID
var handler: (() -> Void)? = nil
fileprivate init(
id: IntrospectionViewID,
handler: ((IntrospectionPlatformViewController) -> Void)?
) {
self.id = id
super.init(nibName: nil, bundle: nil)
self.handler = { [weak self] in
guard let self else { return }
handler?(self)
}
self.isIntrospectionPlatformEntity = true
IntrospectionStore.shared[id, default: .init()].controller = self
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
#if canImport(UIKit)
#if os(iOS)
override var preferredStatusBarStyle: UIStatusBarStyle {
parent?.preferredStatusBarStyle ?? super.preferredStatusBarStyle
}
#endif
override func viewDidLoad() {
super.viewDidLoad()
view.introspectionController = self
view.isIntrospectionPlatformEntity = true
handler?()
}
override func didMove(toParent parent: UIViewController?) {
super.didMove(toParent: parent)
handler?()
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
handler?()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
handler?()
}
#elseif canImport(AppKit)
override func loadView() {
view = NSView()
view.introspectionController = self
view.isIntrospectionPlatformEntity = true
}
override func viewDidLoad() {
super.viewDidLoad()
handler?()
}
override func viewDidAppear() {
super.viewDidAppear()
handler?()
}
#endif
}
import ObjectiveC
extension PlatformView {
fileprivate var introspectionController: IntrospectionPlatformViewController? {
get {
let key = unsafeBitCast(Selector(#function), to: UnsafeRawPointer.self)
return (objc_getAssociatedObject(self, key) as? Weak<IntrospectionPlatformViewController>)?.wrappedValue
}
set {
let key = unsafeBitCast(Selector(#function), to: UnsafeRawPointer.self)
objc_setAssociatedObject(self, key, Weak(wrappedValue: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
extension PlatformEntity {
var isIntrospectionPlatformEntity: Bool {
get {
let key = unsafeBitCast(Selector(#function), to: UnsafeRawPointer.self)
return objc_getAssociatedObject(self, key) as? Bool ?? false
}
set {
let key = unsafeBitCast(Selector(#function), to: UnsafeRawPointer.self)
objc_setAssociatedObject(self, key, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
#endif
================================================
FILE: Sources/PlatformVersion.swift
================================================
#if !os(watchOS)
import Foundation
@_spi(Internals)
public enum PlatformVersionCondition: Sendable {
case past
case current
case future
}
public protocol PlatformVersion: Sendable {
@_spi(Internals)
var condition: PlatformVersionCondition? { get }
}
extension PlatformVersion {
@_spi(Internals)
public var isCurrent: Bool {
condition == .current
}
@_spi(Internals)
public var isCurrentOrPast: Bool {
condition == .current || condition == .past
}
@_spi(Internals)
public var condition: PlatformVersionCondition? { nil }
}
public struct iOSVersion: PlatformVersion {
@_spi(Internals)
public let condition: PlatformVersionCondition?
@_spi(Internals)
public init(condition: () -> PlatformVersionCondition?) {
self.condition = condition()
}
}
extension iOSVersion {
public static let v13 = iOSVersion {
#if os(iOS)
if #available(iOS 14, *) {
return .past
}
if #available(iOS 13, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v14 = iOSVersion {
#if os(iOS)
if #available(iOS 15, *) {
return .past
}
if #available(iOS 14, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v15 = iOSVersion {
#if os(iOS)
if #available(iOS 16, *) {
return .past
}
if #available(iOS 15, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v16 = iOSVersion {
#if os(iOS)
if #available(iOS 17, *) {
return .past
}
if #available(iOS 16, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v17 = iOSVersion {
#if os(iOS)
if #available(iOS 18, *) {
return .past
}
if #available(iOS 17, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v18 = iOSVersion {
#if os(iOS)
if #available(iOS 19, *) {
return .past
}
if #available(iOS 18, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v26 = iOSVersion {
#if os(iOS)
if #available(iOS 27, *) {
return .past
}
// Apps built before the iOS 26 SDK get "19.0" as the system version from ProcessInfo.
// Once built with the iOS 26 SDK, the version then becomes "26.0".
if #available(iOS 19, *) {
return .current
}
return .future
#else
return nil
#endif
}
}
public struct tvOSVersion: PlatformVersion {
@_spi(Internals)
public let condition: PlatformVersionCondition?
@_spi(Internals)
public init(condition: () -> PlatformVersionCondition?) {
self.condition = condition()
}
}
extension tvOSVersion {
public static let v13 = tvOSVersion {
#if os(tvOS)
if #available(tvOS 14, *) {
return .past
}
if #available(tvOS 13, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v14 = tvOSVersion {
#if os(tvOS)
if #available(tvOS 15, *) {
return .past
}
if #available(tvOS 14, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v15 = tvOSVersion {
#if os(tvOS)
if #available(tvOS 16, *) {
return .past
}
if #available(tvOS 15, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v16 = tvOSVersion {
#if os(tvOS)
if #available(tvOS 17, *) {
return .past
}
if #available(tvOS 16, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v17 = tvOSVersion {
#if os(tvOS)
if #available(tvOS 18, *) {
return .past
}
if #available(tvOS 17, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v18 = tvOSVersion {
#if os(tvOS)
if #available(tvOS 19, *) {
return .past
}
if #available(tvOS 18, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v26 = tvOSVersion {
#if os(tvOS)
if #available(tvOS 27, *) {
return .past
}
// Apps built before the tvOS 26 SDK get "19.0" as the system version from ProcessInfo.
// Once built with the tvOS 26 SDK, the version then becomes "26.0".
if #available(tvOS 19, *) {
return .current
}
return .future
#else
return nil
#endif
}
}
public struct macOSVersion: PlatformVersion {
@_spi(Internals)
public let condition: PlatformVersionCondition?
@_spi(Internals)
public init(condition: () -> PlatformVersionCondition?) {
self.condition = condition()
}
}
extension macOSVersion {
public static let v10_15 = macOSVersion {
#if os(macOS)
if #available(macOS 11, *) {
return .past
}
if #available(macOS 10.15, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v10_15_4 = macOSVersion {
#if os(macOS)
if #available(macOS 11, *) {
return .past
}
if #available(macOS 10.15.4, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v11 = macOSVersion {
#if os(macOS)
if #available(macOS 12, *) {
return .past
}
if #available(macOS 11, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v12 = macOSVersion {
#if os(macOS)
if #available(macOS 13, *) {
return .past
}
if #available(macOS 12, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v13 = macOSVersion {
#if os(macOS)
if #available(macOS 14, *) {
return .past
}
if #available(macOS 13, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v14 = macOSVersion {
#if os(macOS)
if #available(macOS 15, *) {
return .past
}
if #available(macOS 14, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v15 = macOSVersion {
#if os(macOS)
if #available(macOS 16, *) {
return .past
}
if #available(macOS 15, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v26 = macOSVersion {
#if os(macOS)
if #available(macOS 27, *) {
return .past
}
// Apps built before the macOS 26 SDK get "16.0" as the system version from ProcessInfo.
// Once built with the macOS 26 SDK, the version then becomes "26.0".
if #available(macOS 16, *) {
return .current
}
return .future
#else
return nil
#endif
}
}
public struct visionOSVersion: PlatformVersion {
@_spi(Internals)
public let condition: PlatformVersionCondition?
@_spi(Internals)
public init(condition: () -> PlatformVersionCondition?) {
self.condition = condition()
}
}
extension visionOSVersion {
public static let v1 = visionOSVersion {
#if os(visionOS)
if #available(visionOS 2, *) {
return .past
}
if #available(visionOS 1, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v2 = visionOSVersion {
#if os(visionOS)
if #available(visionOS 3, *) {
return .past
}
if #available(visionOS 2, *) {
return .current
}
return .future
#else
return nil
#endif
}
public static let v26 = visionOSVersion {
#if os(visionOS)
if #available(visionOS 27, *) {
return .past
}
// Apps built before the visionOS 26 SDK get "3.0" as the system version from ProcessInfo.
// Once built with the visionOS 26 SDK, the version then becomes "26.0".
if #available(visionOS 3, *) {
return .current
}
return .future
#else
return nil
#endif
}
}
#endif
================================================
FILE: Sources/PlatformView.swift
================================================
#if !os(watchOS)
public import SwiftUI
#if canImport(UIKit)
public typealias PlatformView = UIView
#elseif canImport(AppKit)
public typealias PlatformView = NSView
#endif
#if canImport(UIKit)
public typealias PlatformViewController = UIViewController
#elseif canImport(AppKit)
public typealias PlatformViewController = NSViewController
#endif
#if canImport(UIKit)
@_spi(Internals)
public typealias _PlatformViewControllerRepresentable = UIViewControllerRepresentable
#elseif canImport(AppKit)
@_spi(Internals)
public typealias _PlatformViewControllerRepresentable = NSViewControllerRepresentable
#endif
@MainActor
@_spi(Internals)
public protocol PlatformViewControllerRepresentable: _PlatformViewControllerRepresentable {
#if canImport(UIKit)
typealias ViewController = UIViewControllerType
#elseif canImport(AppKit)
typealias ViewController = NSViewControllerType
#endif
func makePlatformViewController(context: Context) -> ViewController
func updatePlatformViewController(_ controller: ViewController, context: Context)
static func dismantlePlatformViewController(_ controller: ViewController, coordinator: Coordinator)
}
@_spi(Internals)
extension PlatformViewControllerRepresentable {
#if canImport(UIKit)
public func makeUIViewController(context: Context) -> ViewController {
makePlatformViewController(context: context)
}
public func updateUIViewController(_ controller: ViewController, context: Context) {
updatePlatformViewController(controller, context: context)
}
public static func dismantleUIViewController(_ controller: ViewController, coordinator: Coordinator) {
dismantlePlatformViewController(controller, coordinator: coordinator)
}
#elseif canImport(AppKit)
public func makeNSViewController(context: Context) -> ViewController {
makePlatformViewController(context: context)
}
public func updateNSViewController(_ controller: ViewController, context: Context) {
updatePlatformViewController(controller, context: context)
}
public static func dismantleNSViewController(_ controller: ViewController, coordinator: Coordinator) {
dismantlePlatformViewController(controller, coordinator: coordinator)
}
#endif
}
#endif
================================================
FILE: Sources/PlatformViewVersion.swift
================================================
#if !os(watchOS)
import SwiftUI
@MainActor
public struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> {
let selector: IntrospectionSelector<PlatformSpecificEntity>?
private init<Version: PlatformVersion>(
_ versions: [PlatformViewVersion<Version, SwiftUIViewType, PlatformSpecificEntity>],
matches: (PlatformViewVersion<Version, SwiftUIViewType, PlatformSpecificEntity>) -> Bool
) {
if let matchingVersion = versions.first(where: matches) {
self.selector = matchingVersion.selector ?? .default
} else {
self.selector = nil
}
}
public static func iOS(_ versions: iOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
Self(versions, matches: \.isCurrent)
}
@_spi(Advanced)
public static func iOS(_ versions: PartialRangeFrom<iOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>>) -> Self {
Self([versions.lowerBound], matches: \.isCurrentOrPast)
}
public static func tvOS(_ versions: tvOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
Self(versions, matches: \.isCurrent)
}
@_spi(Advanced)
public static func tvOS(_ versions: PartialRangeFrom<tvOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>>) -> Self {
Self([versions.lowerBound], matches: \.isCurrentOrPast)
}
public static func macOS(_ versions: macOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
Self(versions, matches: \.isCurrent)
}
@_spi(Advanced)
public static func macOS(_ versions: PartialRangeFrom<macOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>>) -> Self {
Self([versions.lowerBound], matches: \.isCurrentOrPast)
}
public static func visionOS(_ versions: visionOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>...) -> Self {
Self(versions, matches: \.isCurrent)
}
@_spi(Advanced)
public static func visionOS(_ versions: PartialRangeFrom<visionOSViewVersion<SwiftUIViewType, PlatformSpecificEntity>>) -> Self {
Self([versions.lowerBound], matches: \.isCurrentOrPast)
}
}
public typealias iOSViewVersion<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> =
PlatformViewVersion<iOSVersion, SwiftUIViewType, PlatformSpecificEntity>
public typealias tvOSViewVersion<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> =
PlatformViewVersion<tvOSVersion, SwiftUIViewType, PlatformSpecificEntity>
public typealias macOSViewVersion<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> =
PlatformViewVersion<macOSVersion, SwiftUIViewType, PlatformSpecificEntity>
public typealias visionOSViewVersion<SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> =
PlatformViewVersion<visionOSVersion, SwiftUIViewType, PlatformSpecificEntity>
@MainActor
public enum PlatformViewVersion<Version: PlatformVersion, SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity>: Sendable {
@_spi(Internals) case available(Version, IntrospectionSelector<PlatformSpecificEntity>?)
@_spi(Internals) case unavailable
@_spi(Advanced) public init(for version: Version, selector: IntrospectionSelector<PlatformSpecificEntity>? = nil) {
self = .available(version, selector)
}
@_spi(Advanced) public static func unavailable(file: StaticString = #file, line: UInt = #line) -> Self {
let filePath = file.withUTF8Buffer { String(decoding: $0, as: UTF8.self) }
let fileName = URL(fileURLWithPath: filePath).lastPathComponent
print(
"""
If you're seeing this, someone forgot to mark \(fileName):\(line) as unavailable.
This won't have any effect, but it should be disallowed altogether.
Please report it upstream so we can properly fix it by using the following link:
https://github.com/siteline/swiftui-introspect/issues/new?title=`\(fileName):\(line)`+should+be+marked+unavailable
"""
)
return .unavailable
}
private var version: Version? {
if case let .available(version, _) = self {
version
} else {
nil
}
}
@MainActor
fileprivate var selector: IntrospectionSelector<PlatformSpecificEntity>? {
if case let .available(_, selector) = self {
selector
} else {
nil
}
}
fileprivate var isCurrent: Bool {
version?.isCurrent ?? false
}
fileprivate var isCurrentOrPast: Bool {
version?.isCurrentOrPast ?? false
}
}
// This conformance isn't meant to be used directly by the user,
// it's only to satisfy requirements for forming ranges (e.g. `.v15...`).
extension PlatformViewVersion: Comparable {
public nonisolated static func == (lhs: Self, rhs: Self) -> Bool {
true
}
public nonisolated static func < (lhs: Self, rhs: Self) -> Bool {
true
}
}
#endif
================================================
FILE: Sources/Utils.swift
================================================
postfix operator ~
postfix func ~ <T>(lhs: some Any) -> T {
lhs as! T
}
postfix func ~ <T>(lhs: (some Any)?) -> T? {
lhs as? T
}
func recursiveSequence<S: Sequence>(_ sequence: S, children: @escaping (S.Element) -> S) -> AnySequence<S.Element> {
AnySequence {
var mainIterator = sequence.makeIterator()
// Current iterator, or `nil` if all sequences are exhausted:
var iterator: AnyIterator<S.Element>?
return AnyIterator {
guard let iterator, let element = iterator.next() else {
if let element = mainIterator.next() {
iterator = recursiveSequence(children(element), children: children).makeIterator()
return element
}
return nil
}
return element
}
}
}
================================================
FILE: Sources/ViewTypes/Button.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `Button` type in SwiftUI.
///
/// ### iOS
///
/// Not available.
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS 10.15 – 15
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// VStack {
/// Button("Plain Button", action: {})
/// .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15)) {
/// print(type(of: $0)) // NSButton
/// }
///
/// Button("Bordered Button", action: {})
/// .buttonStyle(.bordered)
/// .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15)) {
/// print(type(of: $0)) // NSButton
/// }
///
/// Button("Borderless Button", action: {})
/// .buttonStyle(.borderless)
/// .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15)) {
/// print(type(of: $0)) // NSButton
/// }
///
/// Button("Link Button", action: {})
/// .buttonStyle(.link)
/// .introspect(.button, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15)) {
/// print(type(of: $0)) // NSButton
/// }
/// }
/// }
/// }
/// ```
///
/// ### macOS 26
///
/// On macOS 26, only the `.borderless` and `.link` button styles are supported for introspection.
/// Other styles (e.g., plain or bordered) are not supported on macOS 26.
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// VStack {
/// Button("Borderless Button", action: {})
/// .buttonStyle(.borderless)
/// .introspect(.button, on: .macOS(.v26)) {
/// print(type(of: $0)) // NSButton
/// }
///
/// Button("Link Button", action: {})
/// .buttonStyle(.link)
/// .introspect(.button, on: .macOS(.v26)) {
/// print(type(of: $0)) // NSButton
/// }
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// Not available.
public struct ButtonType: IntrospectableViewType {}
#if !os(iOS) && !os(tvOS) && !os(visionOS)
extension IntrospectableViewType where Self == ButtonType {
public static var button: Self { .init() }
}
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
public import AppKit
extension macOSViewVersion<ButtonType, NSButton> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/ColorPicker.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `ColorPicker` type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// @State var color = Color.red
///
/// var body: some View {
/// ColorPicker("Pick a color", selection: $color)
/// .introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIColorPicker
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// @State var color = Color.red
///
/// var body: some View {
/// ColorPicker("Pick a color", selection: $color)
/// .introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSColorPicker
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var color = Color.red
///
/// var body: some View {
/// ColorPicker("Pick a color", selection: $color)
/// .introspect(.colorPicker, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIColorPicker
/// }
/// }
/// }
/// ```
public struct ColorPickerType: IntrospectableViewType {}
#if !os(tvOS)
extension IntrospectableViewType where Self == ColorPickerType {
public static var colorPicker: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
@available(iOS 14, *)
extension iOSViewVersion<ColorPickerType, UIColorWell> {
@available(*, unavailable, message: "ColorPicker isn't available on iOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
@available(iOS 14, *)
extension visionOSViewVersion<ColorPickerType, UIColorWell> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
@available(macOS 11, *)
extension macOSViewVersion<ColorPickerType, NSColorWell> {
@available(*, unavailable, message: "ColorPicker isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/DatePicker.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `DatePicker` type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSDatePicker
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .introspect(.datePicker, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
public struct DatePickerType: IntrospectableViewType {}
#if !os(tvOS)
extension IntrospectableViewType where Self == DatePickerType {
public static var datePicker: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<DatePickerType, UIDatePicker> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<DatePickerType, UIDatePicker> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<DatePickerType, NSDatePicker> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/DatePickerWithCompactStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `DatePicker` type in SwiftUI, with `.compact` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.compact)
/// .introspect(.datePicker(style: .compact), on: .macOS(.v10_15_4, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSDatePicker
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.compact)
/// .introspect(.datePicker(style: .compact), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
public struct DatePickerWithCompactStyleType: IntrospectableViewType {
public enum Style: Sendable {
case compact
}
}
#if !os(tvOS)
extension IntrospectableViewType where Self == DatePickerWithCompactStyleType {
public static func datePicker(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<DatePickerWithCompactStyleType, UIDatePicker> {
@available(*, unavailable, message: ".datePickerStyle(.compact) isn't available on iOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<DatePickerWithCompactStyleType, UIDatePicker> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit) && !targetEnvironment(macCatalyst)
public import AppKit
extension macOSViewVersion<DatePickerWithCompactStyleType, NSDatePicker> {
@available(*, unavailable, message: ".datePickerStyle(.compact) isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
public static let v10_15_4 = Self(for: .v10_15_4)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/DatePickerWithFieldStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `DatePicker` type in SwiftUI, with `.field` style.
///
/// ### iOS
///
/// Not available.
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.field)
/// .introspect(.datePicker(style: .field), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSDatePicker
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// Not available.
public struct DatePickerWithFieldStyleType: IntrospectableViewType {
public enum Style: Sendable {
case field
}
}
#if !os(iOS) && !os(tvOS) && !os(visionOS)
extension IntrospectableViewType where Self == DatePickerWithFieldStyleType {
public static func datePicker(style: Self.Style) -> Self { .init() }
}
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
public import AppKit
extension macOSViewVersion<DatePickerWithFieldStyleType, NSDatePicker> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/DatePickerWithGraphicalStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `DatePicker` type in SwiftUI, with `.graphical` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.graphical)
/// .introspect(.datePicker(style: .graphical), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSDatePicker
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.graphical)
/// .introspect(.datePicker(style: .graphical), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
public struct DatePickerWithGraphicalStyleType: IntrospectableViewType {
public enum Style: Sendable {
case graphical
}
}
#if !os(tvOS)
extension IntrospectableViewType where Self == DatePickerWithGraphicalStyleType {
public static func datePicker(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<DatePickerWithGraphicalStyleType, UIDatePicker> {
@available(*, unavailable, message: ".datePickerStyle(.graphical) isn't available on iOS 13")
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<DatePickerWithGraphicalStyleType, UIDatePicker> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit) && !targetEnvironment(macCatalyst)
public import AppKit
extension macOSViewVersion<DatePickerWithGraphicalStyleType, NSDatePicker> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/DatePickerWithStepperFieldStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `DatePicker` type in SwiftUI, with `.stepperField` style.
///
/// ### iOS
///
/// Not available.
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.stepperField)
/// .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSDatePicker
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// Not available.
public struct DatePickerWithStepperFieldStyleType: IntrospectableViewType {
public enum Style: Sendable {
case stepperField
}
}
#if !os(iOS) && !os(tvOS) && !os(visionOS)
extension IntrospectableViewType where Self == DatePickerWithStepperFieldStyleType {
public static func datePicker(style: Self.Style) -> Self { .init() }
}
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
public import AppKit
extension macOSViewVersion<DatePickerWithStepperFieldStyleType, NSDatePicker> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/DatePickerWithWheelStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `DatePicker` type in SwiftUI, with `.wheel` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.wheel)
/// .introspect(.datePicker(style: .wheel), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIDatePicker
/// }
/// }
/// }
/// ```
public struct DatePickerWithWheelStyleType: IntrospectableViewType {
public enum Style: Sendable {
case wheel
}
}
#if !os(tvOS) && !os(macOS)
extension IntrospectableViewType where Self == DatePickerWithWheelStyleType {
public static func datePicker(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<DatePickerWithWheelStyleType, UIDatePicker> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<DatePickerWithWheelStyleType, UIDatePicker> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/Form.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `Form` type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// Form {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .introspect(.form, on: .iOS(.v13, .v14, .v15)) {
/// print(type(of: $0)) // UITableView
/// }
/// .introspect(.form, on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// Form {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .introspect(.form, on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UITableView
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// Form {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .introspect(.form, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
public struct FormType: IntrospectableViewType {}
#if !os(macOS)
extension IntrospectableViewType where Self == FormType {
public static var form: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<FormType, UITableView> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
extension iOSViewVersion<FormType, UICollectionView> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<FormType, UITableView> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<FormType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/FormWithGroupedStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `Form` type in SwiftUI, with `.grouped` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// Form {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .formStyle(.grouped)
/// .introspect(.form(style: .grouped), on: .tvOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UITableView
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// Form {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .formStyle(.grouped)
/// .introspect(.form(style: .grouped), on: .macOS(.v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSScrollView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// Form {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .formStyle(.grouped)
/// .introspect(.form(style: .grouped), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
public struct FormWithGroupedStyleType: IntrospectableViewType {
public enum Style: Sendable {
case grouped
}
}
extension IntrospectableViewType where Self == FormWithGroupedStyleType {
public static func form(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<FormWithGroupedStyleType, UITableView> {
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on iOS 13")
public static let v13 = Self.unavailable()
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on iOS 14")
public static let v14 = Self.unavailable()
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on iOS 15")
public static let v15 = Self.unavailable()
}
extension iOSViewVersion<FormWithGroupedStyleType, UICollectionView> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<FormWithGroupedStyleType, UITableView> {
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on tvOS 13")
public static let v13 = Self.unavailable()
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on tvOS 14")
public static let v14 = Self.unavailable()
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on tvOS 15")
public static let v15 = Self.unavailable()
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<FormWithGroupedStyleType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<FormWithGroupedStyleType, NSScrollView> {
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on macOS 11")
public static let v11 = Self.unavailable()
@available(*, unavailable, message: ".formStyle(.grouped) isn't available on macOS 12")
public static let v12 = Self.unavailable()
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/FullScreenCover.swift
================================================
#if !os(watchOS)
/// An abstract representation of `.fullScreenCover` in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// @State var isPresented = false
///
/// var body: some View {
/// Button("Present", action: { isPresented = true })
/// .fullScreenCover(isPresented: $isPresented) {
/// Button("Dismiss", action: { isPresented = false })
/// .introspect(.fullScreenCover, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIPresentationController
/// }
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// @State var isPresented = false
///
/// var body: some View {
/// Button("Present", action: { isPresented = true })
/// .fullScreenCover(isPresented: $isPresented) {
/// Button("Dismiss", action: { isPresented = false })
/// .introspect(.fullScreenCover, on: .tvOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIPresentationController
/// }
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var isPresented = false
///
/// var body: some View {
/// Button("Present", action: { isPresented = true })
/// .fullScreenCover(isPresented: $isPresented) {
/// Button("Dismiss", action: { isPresented = false })
/// .introspect(.fullScreenCover, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIPresentationController
/// }
/// }
/// }
/// }
/// ```
public struct FullScreenCoverType: IntrospectableViewType {
public var scope: IntrospectionScope { .ancestor }
}
#if !os(macOS)
extension IntrospectableViewType where Self == FullScreenCoverType {
public static var fullScreenCover: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<FullScreenCoverType, UIPresentationController> {
@available(*, unavailable, message: ".fullScreenCover isn't available on iOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14, selector: selector)
public static let v15 = Self(for: .v15, selector: selector)
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UIPresentationController> {
.from(UIViewController.self, selector: { $0.presentationController })
}
}
extension tvOSViewVersion<FullScreenCoverType, UIPresentationController> {
@available(*, unavailable, message: ".fullScreenCover isn't available on tvOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14, selector: selector)
public static let v15 = Self(for: .v15, selector: selector)
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UIPresentationController> {
.from(UIViewController.self, selector: { $0.presentationController })
}
}
extension visionOSViewVersion<FullScreenCoverType, UIPresentationController> {
public static let v1 = Self(for: .v1, selector: selector)
public static let v2 = Self(for: .v2, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UIPresentationController> {
.from(UIViewController.self, selector: { $0.presentationController })
}
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/List.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `List` type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .introspect(.list, on: .iOS(.v13, .v14, .v15)) {
/// print(type(of: $0)) // UITableView
/// }
/// .introspect(.list, on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .introspect(.list, on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UITableView
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSTableView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .introspect(.list, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
public struct ListType: IntrospectableViewType {
public enum Style: Sendable {
case plain
}
}
extension IntrospectableViewType where Self == ListType {
public static var list: Self { .init() }
public static func list(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<ListType, UITableView> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
extension iOSViewVersion<ListType, UICollectionView> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<ListType, UITableView> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<ListType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<ListType, NSTableView> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/ListCell.swift
================================================
#if !os(watchOS)
/// An abstract representation of a `List` cell type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// ForEach(1...3, id: \.self) { int in
/// Text("Item \(int)")
/// .introspect(.listCell, on: .iOS(.v13, .v14, .v15)) {
/// print(type(of: $0)) // UITableViewCell
/// }
/// .introspect(.listCell, on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionViewCell
/// }
/// }
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// ForEach(1...3, id: \.self) { int in
/// Text("Item \(int)")
/// .introspect(.listCell, on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UITableViewCell
/// }
/// }
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// ForEach(1...3, id: \.self) { int in
/// Text("Item \(int)")
/// .introspect(.listCell, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSTableCellView
/// }
/// }
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// ForEach(1...3, id: \.self) { int in
/// Text("Item \(int)")
/// .introspect(.listCell, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionViewCell
/// }
/// }
/// }
/// }
/// }
/// ```
public struct ListCellType: IntrospectableViewType {
public var scope: IntrospectionScope { .ancestor }
}
extension IntrospectableViewType where Self == ListCellType {
public static var listCell: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<ListCellType, UITableViewCell> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
extension iOSViewVersion<ListCellType, UICollectionViewCell> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<ListCellType, UITableViewCell> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<ListCellType, UICollectionViewCell> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<ListCellType, NSTableCellView> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/ListWithBorderedStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `List` type in SwiftUI, with `.bordered` style.
///
/// ### iOS
///
/// Not available.
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.bordered)
/// .introspect(.list(style: .bordered), on: .macOS(.v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSTableView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// Not available.
public struct ListWithBorderedStyleType: IntrospectableViewType {
public enum Style: Sendable {
case bordered
}
}
#if !os(iOS) && !os(tvOS) && !os(visionOS)
extension IntrospectableViewType where Self == ListWithBorderedStyleType {
public static func list(style: Self.Style) -> Self { .init() }
}
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
public import AppKit
extension macOSViewVersion<ListWithBorderedStyleType, NSTableView> {
@available(*, unavailable, message: ".listStyle(.insetGrouped) isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
@available(*, unavailable, message: ".listStyle(.insetGrouped) isn't available on macOS 11")
public static let v11 = Self.unavailable()
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/ListWithGroupedStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `List` type in SwiftUI, with `.grouped` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v13, .v14, .v15)) {
/// print(type(of: $0)) // UITableView
/// }
/// .introspect(.list(style: .grouped), on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.grouped)
/// .introspect(.list(style: .grouped), on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UITableView
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.grouped)
/// .introspect(.list(style: .grouped), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
public struct ListWithGroupedStyleType: IntrospectableViewType {
public enum Style: Sendable {
case grouped
}
}
#if !os(macOS)
extension IntrospectableViewType where Self == ListWithGroupedStyleType {
public static func list(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<ListWithGroupedStyleType, UITableView> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
extension iOSViewVersion<ListWithGroupedStyleType, UICollectionView> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<ListWithGroupedStyleType, UITableView> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<ListWithGroupedStyleType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/ListWithInsetGroupedStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `List` type in SwiftUI, with `.insetGrouped` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v14, .v15)) {
/// print(type(of: $0)) // UITableView
/// }
/// .introspect(.list(style: .insetGrouped), on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.insetGrouped)
/// .introspect(.list(style: .insetGrouped), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
public struct ListWithInsetGroupedStyleType: IntrospectableViewType {
public enum Style: Sendable {
case insetGrouped
}
}
#if !os(tvOS) && !os(macOS)
extension IntrospectableViewType where Self == ListWithInsetGroupedStyleType {
public static func list(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<ListWithInsetGroupedStyleType, UITableView> {
@available(*, unavailable, message: ".listStyle(.insetGrouped) isn't available on iOS 13")
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
extension iOSViewVersion<ListWithInsetGroupedStyleType, UICollectionView> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<ListWithInsetGroupedStyleType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/ListWithInsetStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `List` type in SwiftUI, with `.inset` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v14, .v15)) {
/// print(type(of: $0)) // UITableView
/// }
/// .introspect(.list(style: .inset), on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.inset)
/// .introspect(.list(style: .inset), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSTableView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.inset)
/// .introspect(.list(style: .inset), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
public struct ListWithInsetStyleType: IntrospectableViewType {
public enum Style: Sendable {
case inset
}
}
#if !os(tvOS)
extension IntrospectableViewType where Self == ListWithInsetStyleType {
public static func list(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<ListWithInsetStyleType, UITableView> {
@available(*, unavailable, message: ".listStyle(.inset) isn't available on iOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
extension iOSViewVersion<ListWithInsetStyleType, UICollectionView> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<ListWithInsetStyleType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<ListWithInsetStyleType, NSTableView> {
@available(*, unavailable, message: ".listStyle(.inset) isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/ListWithSidebarStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `List` type in SwiftUI, with `.sidebar` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v14, .v15)) {
/// print(type(of: $0)) // UITableView
/// }
/// .introspect(.list(style: .sidebar), on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.sidebar)
/// .introspect(.list(style: .sidebar), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSTableView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// List {
/// Text("Item 1")
/// Text("Item 2")
/// Text("Item 3")
/// }
/// .listStyle(.sidebar)
/// .introspect(.list(style: .sidebar), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UICollectionView
/// }
/// }
/// }
/// ```
public struct ListWithSidebarStyleType: IntrospectableViewType {
public enum Style: Sendable {
case sidebar
}
}
#if !os(tvOS)
extension IntrospectableViewType where Self == ListWithSidebarStyleType {
public static func list(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<ListWithSidebarStyleType, UITableView> {
@available(*, unavailable, message: ".listStyle(.sidebar) isn't available on iOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
extension iOSViewVersion<ListWithSidebarStyleType, UICollectionView> {
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<ListWithSidebarStyleType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<ListWithSidebarStyleType, NSTableView> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/Map.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `Map` type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// @State var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))
///
/// var body: some View {
/// Map(coordinateRegion: $region)
/// .introspect(.map, on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // MKMapView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// @State var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))
///
/// var body: some View {
/// Map(coordinateRegion: $region)
/// .introspect(.map, on: .tvOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // MKMapView
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// @State var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))
///
/// var body: some View {
/// Map(coordinateRegion: $region)
/// .introspect(.map, on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // MKMapView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))
///
/// var body: some View {
/// Map(coordinateRegion: $region)
/// .introspect(.map, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // MKMapView
/// }
/// }
/// }
/// ```
public struct MapType: IntrospectableViewType {}
#if canImport(MapKit)
public import MapKit
extension IntrospectableViewType where Self == MapType {
public static var map: Self { .init() }
}
extension iOSViewVersion<MapType, MKMapView> {
@available(*, unavailable, message: "Map isn't available on iOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<MapType, MKMapView> {
@available(*, unavailable, message: "Map isn't available on tvOS 13")
public static let v13 = Self.unavailable()
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension macOSViewVersion<MapType, MKMapView> {
@available(*, unavailable, message: "Map isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<MapType, MKMapView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/NavigationSplitView.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `NavigationSplitView` type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationSplitView {
/// Text("Root")
/// } detail: {
/// Text("Detail")
/// }
/// .introspect(.navigationSplitView, on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UISplitViewController
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationSplitView {
/// Text("Root")
/// } detail: {
/// Text("Detail")
/// }
/// .introspect(.navigationSplitView, on: .tvOS(.v16, .v17)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationSplitView {
/// Text("Root")
/// } detail: {
/// Text("Detail")
/// }
/// .introspect(.navigationSplitView, on: .macOS(.v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSSplitView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationSplitView {
/// Text("Root")
/// } detail: {
/// Text("Detail")
/// }
/// .introspect(.navigationSplitView, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UISplitViewController
/// }
/// }
/// }
/// ```
public struct NavigationSplitViewType: IntrospectableViewType {}
extension IntrospectableViewType where Self == NavigationSplitViewType {
public static var navigationSplitView: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<NavigationSplitViewType, UISplitViewController> {
@available(*, unavailable, message: "NavigationSplitView isn't available on iOS 13")
public static let v13 = Self.unavailable()
@available(*, unavailable, message: "NavigationSplitView isn't available on iOS 14")
public static let v14 = Self.unavailable()
@available(*, unavailable, message: "NavigationSplitView isn't available on iOS 15")
public static let v15 = Self.unavailable()
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UISplitViewController> {
.default.withAncestorSelector { $0.splitViewController }
}
}
extension tvOSViewVersion<NavigationSplitViewType, UINavigationController> {
@available(*, unavailable, message: "NavigationSplitView isn't available on tvOS 13")
public static let v13 = Self.unavailable()
@available(*, unavailable, message: "NavigationSplitView isn't available on tvOS 14")
public static let v14 = Self.unavailable()
@available(*, unavailable, message: "NavigationSplitView isn't available on tvOS 15")
public static let v15 = Self.unavailable()
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
@available(*, unavailable, message: "NavigationSplitView isn't backed by UIKit since tvOS 18")
public static let v18 = Self.unavailable()
@available(*, unavailable, message: "NavigationSplitView isn't backed by UIKit since tvOS 18")
public static let v26 = Self.unavailable()
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
extension visionOSViewVersion<NavigationSplitViewType, UISplitViewController> {
public static let v1 = Self(for: .v1, selector: selector)
public static let v2 = Self(for: .v2, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UISplitViewController> {
.default.withAncestorSelector { $0.splitViewController }
}
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<NavigationSplitViewType, NSSplitView> {
@available(*, unavailable, message: "NavigationSplitView isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
@available(*, unavailable, message: "NavigationSplitView isn't available on macOS 11")
public static let v11 = Self.unavailable()
@available(*, unavailable, message: "NavigationSplitView isn't available on macOS 12")
public static let v12 = Self.unavailable()
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/NavigationStack.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `NavigationStack` type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationStack {
/// Text("Root")
/// }
/// .introspect(.navigationStack, on: .iOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationStack {
/// Text("Root")
/// }
/// .introspect(.navigationStack, on: .tvOS(.v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationStack {
/// Text("Root")
/// }
/// .introspect(.navigationStack, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
public struct NavigationStackType: IntrospectableViewType {}
extension IntrospectableViewType where Self == NavigationStackType {
public static var navigationStack: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<NavigationStackType, UINavigationController> {
@available(*, unavailable, message: "NavigationStack isn't available on iOS 13")
public static let v13 = Self.unavailable()
@available(*, unavailable, message: "NavigationStack isn't available on iOS 14")
public static let v14 = Self.unavailable()
@available(*, unavailable, message: "NavigationStack isn't available on iOS 15")
public static let v15 = Self.unavailable()
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
extension tvOSViewVersion<NavigationStackType, UINavigationController> {
@available(*, unavailable, message: "NavigationStack isn't available on tvOS 13")
public static let v13 = Self.unavailable()
@available(*, unavailable, message: "NavigationStack isn't available on tvOS 14")
public static let v14 = Self.unavailable()
@available(*, unavailable, message: "NavigationStack isn't available on tvOS 15")
public static let v15 = Self.unavailable()
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
extension visionOSViewVersion<NavigationStackType, UINavigationController> {
public static let v1 = Self(for: .v1, selector: selector)
public static let v2 = Self(for: .v2, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/NavigationViewWithColumnsStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `NavigationView` type in SwiftUI, with `.columns` style.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationView {
/// Text("Root")
/// }
/// .navigationViewStyle(DoubleColumnNavigationViewStyle())
/// .introspect(.navigationView(style: .columns), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UISplitViewController
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationView {
/// Text("Root")
/// }
/// .navigationViewStyle(DoubleColumnNavigationViewStyle())
/// .introspect(.navigationView(style: .columns), on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationView {
/// Text("Root")
/// }
/// .navigationViewStyle(DoubleColumnNavigationViewStyle())
/// .introspect(.navigationView(style: .columns), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSSplitView
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationView {
/// Text("Root")
/// }
/// .navigationViewStyle(DoubleColumnNavigationViewStyle())
/// .introspect(.navigationView(style: .columns), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UISplitViewController
/// }
/// }
/// }
/// ```
public struct NavigationViewWithColumnsStyleType: IntrospectableViewType {
public enum Style: Sendable {
case columns
}
}
extension IntrospectableViewType where Self == NavigationViewWithColumnsStyleType {
public static func navigationView(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<NavigationViewWithColumnsStyleType, UISplitViewController> {
public static let v13 = Self(for: .v13, selector: selector)
public static let v14 = Self(for: .v14, selector: selector)
public static let v15 = Self(for: .v15, selector: selector)
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UISplitViewController> {
.default.withAncestorSelector { $0.splitViewController }
}
}
extension tvOSViewVersion<NavigationViewWithColumnsStyleType, UINavigationController> {
public static let v13 = Self(for: .v13, selector: selector)
public static let v14 = Self(for: .v14, selector: selector)
public static let v15 = Self(for: .v15, selector: selector)
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
extension visionOSViewVersion<NavigationViewWithColumnsStyleType, UISplitViewController> {
public static let v1 = Self(for: .v1, selector: selector)
public static let v2 = Self(for: .v2, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UISplitViewController> {
.default.withAncestorSelector { $0.splitViewController }
}
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<NavigationViewWithColumnsStyleType, NSSplitView> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/NavigationViewWithStackStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `NavigationView` type in SwiftUI, with `.stack` style.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationView {
/// Text("Root")
/// }
/// .navigationViewStyle(.stack)
/// .introspect(.navigationView(style: .stack), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationView {
/// Text("Root")
/// }
/// .navigationViewStyle(.stack)
/// .introspect(.navigationView(style: .stack), on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// NavigationView {
/// Text("Root")
/// }
/// .navigationViewStyle(.stack)
/// .introspect(.navigationView(style: .stack), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UINavigationController
/// }
/// }
/// }
/// ```
public struct NavigationViewWithStackStyleType: IntrospectableViewType {
public enum Style: Sendable {
case stack
}
}
extension IntrospectableViewType where Self == NavigationViewWithStackStyleType {
public static func navigationView(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<NavigationViewWithStackStyleType, UINavigationController> {
public static let v13 = Self(for: .v13, selector: selector)
public static let v14 = Self(for: .v14, selector: selector)
public static let v15 = Self(for: .v15, selector: selector)
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
extension tvOSViewVersion<NavigationViewWithStackStyleType, UINavigationController> {
public static let v13 = Self(for: .v13, selector: selector)
public static let v14 = Self(for: .v14, selector: selector)
public static let v15 = Self(for: .v15, selector: selector)
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
extension visionOSViewVersion<NavigationViewWithStackStyleType, UINavigationController> {
public static let v1 = Self(for: .v1, selector: selector)
public static let v2 = Self(for: .v2, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UINavigationController> {
.default.withAncestorSelector { $0.navigationController }
}
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/PageControl.swift
================================================
#if !os(watchOS)
/// An abstract representation of the page control type in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// 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(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIPageControl
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// 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: .tvOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIPageControl
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// 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: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIPageControl
/// }
/// }
/// }
/// ```
public struct PageControlType: IntrospectableViewType {}
extension IntrospectableViewType where Self == PageControlType {
public static var pageControl: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<PageControlType, UIPageControl> {
@available(*, unavailable, message: ".tabViewStyle(.page) isn't available on iOS 13")
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<PageControlType, UIPageControl> {
@available(*, unavailable, message: ".tabViewStyle(.page) isn't available on tvOS 13")
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<PageControlType, UIPageControl> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/PickerWithMenuStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `Picker` type in SwiftUI, with `.menu` style.
///
/// ### iOS
///
/// Not available.
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// 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(.menu)
/// .introspect(.picker(style: .menu), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSPopUpButton
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// Not available.
public struct PickerWithMenuStyleType: IntrospectableViewType {
public enum Style: Sendable {
case menu
}
}
#if !os(iOS) && !os(tvOS) && !os(visionOS)
extension IntrospectableViewType where Self == PickerWithMenuStyleType {
public static func picker(style: Self.Style) -> Self { .init() }
}
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
public import AppKit
extension macOSViewVersion<PickerWithMenuStyleType, NSPopUpButton> {
@available(*, unavailable, message: ".pickerStyle(.menu) isn't available on macOS 10.15")
public static let v10_15 = Self.unavailable()
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/PickerWithSegmentedStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `Picker` type in SwiftUI, with `.segmented` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UISegmentedControl
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// 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: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UISegmentedControl
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// 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: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSSegmentedControl
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// 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: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UISegmentedControl
/// }
/// }
/// }
/// ```
public struct PickerWithSegmentedStyleType: IntrospectableViewType {
public enum Style: Sendable {
case segmented
}
}
extension IntrospectableViewType where Self == PickerWithSegmentedStyleType {
public static func picker(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<PickerWithSegmentedStyleType, UISegmentedControl> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension tvOSViewVersion<PickerWithSegmentedStyleType, UISegmentedControl> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<PickerWithSegmentedStyleType, UISegmentedControl> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#elseif canImport(AppKit)
public import AppKit
extension macOSViewVersion<PickerWithSegmentedStyleType, NSSegmentedControl> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v26 = Self(for: .v26)
}
#endif
#endif
================================================
FILE: Sources/ViewTypes/PickerWithWheelStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `Picker` type in SwiftUI, with `.wheel` style.
///
/// ### iOS
///
/// ```swift
/// 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(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIPickerView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// 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: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIPickerView
/// }
/// }
/// }
/// ```
public struct PickerWithWheelStyleType: IntrospectableViewType {
public enum Style: Sendable {
case wheel
}
}
#if !os(tvOS) && !os(macOS)
extension IntrospectableViewType where Self == PickerWithWheelStyleType {
public static func picker(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<PickerWithWheelStyleType, UIPickerView> {
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
public static let v26 = Self(for: .v26)
}
extension visionOSViewVersion<PickerWithWheelStyleType, UIPickerView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
public static let v26 = Self(for: .v26)
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/Popover.swift
================================================
#if !os(watchOS)
/// An abstract representation of `.popover` in SwiftUI.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// @State var isPresented = false
///
/// var body: some View {
/// Button("Present", action: { isPresented = true })
/// .popover(isPresented: $isPresented) {
/// Button("Dismiss", action: { isPresented = false })
/// .introspect(.popover, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIPopoverPresentationController
/// }
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// Not available.
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// @State var isPresented = false
///
/// var body: some View {
/// Button("Present", action: { isPresented = true })
/// .popover(isPresented: $isPresented) {
/// Button("Dismiss", action: { isPresented = false })
/// .introspect(.popover, on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIPopoverPresentationController
/// }
/// }
/// }
/// }
/// ```
public struct PopoverType: IntrospectableViewType {
public var scope: IntrospectionScope { .ancestor }
}
#if !os(tvOS) && !os(macOS)
extension IntrospectableViewType where Self == PopoverType {
public static var popover: Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<PopoverType, UIPopoverPresentationController> {
public static let v13 = Self(for: .v13, selector: selector)
public static let v14 = Self(for: .v14, selector: selector)
public static let v15 = Self(for: .v15, selector: selector)
public static let v16 = Self(for: .v16, selector: selector)
public static let v17 = Self(for: .v17, selector: selector)
public static let v18 = Self(for: .v18, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UIPopoverPresentationController> {
.from(UIViewController.self, selector: { $0.popoverPresentationController })
}
}
extension visionOSViewVersion<PopoverType, UIPopoverPresentationController> {
public static let v1 = Self(for: .v1, selector: selector)
public static let v2 = Self(for: .v2, selector: selector)
public static let v26 = Self(for: .v26, selector: selector)
private static var selector: IntrospectionSelector<UIPopoverPresentationController> {
.from(UIViewController.self, selector: { $0.popoverPresentationController })
}
}
#endif
#endif
#endif
================================================
FILE: Sources/ViewTypes/ProgressViewWithCircularStyle.swift
================================================
#if !os(watchOS)
/// An abstract representation of the `ProgressView` type in SwiftUI, with `.circular` style.
///
/// ### iOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// ProgressView(value: 0.5)
/// .progressViewStyle(.circular)
/// .introspect(.progressView(style: .circular), on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIActivityIndicatorView
/// }
/// }
/// }
/// ```
///
/// ### tvOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// ProgressView(value: 0.5)
/// .progressViewStyle(.circular)
/// .introspect(.progressView(style: .circular), on: .tvOS(.v14, .v15, .v16, .v17, .v18, .v26)) {
/// print(type(of: $0)) // UIActivityIndicatorView
/// }
/// }
/// }
/// ```
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// ProgressView(value: 0.5)
/// .progressViewStyle(.circular)
/// .introspect(.progressView(style: .circular), on: .macOS(.v11, .v12, .v13, .v14, .v15, .v26)) {
/// print(type(of: $0)) // NSProgressIndicator
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// ```swift
/// struct ContentView: View {
/// var body: some View {
/// ProgressView(value: 0.5)
/// .progressViewStyle(.circular)
/// .introspect(.progressView(style: .circular), on: .visionOS(.v1, .v2, .v26)) {
/// print(type(of: $0)) // UIActivityIndicatorView
/// }
/// }
/// }
/// ```
public struct ProgressViewWithCircularStyleType: IntrospectableViewType {
public enum Style: Sendable {
case circular
}
}
extension IntrospectableViewType where Self == ProgressViewWithCircularStyleType {
public static func progressView(style: Self.Style) -> Self { .init() }
}
#if canImport(UIKit)
public import UIKit
extension iOSViewVersion<ProgressViewWithCircularStyleType, UIActivityIndicatorView> {
@available(*, unavailable, message: ".progressViewStyle(.circular) isn't available on iOS 13")
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
public static l
gitextract_d1c0xsyf/
├── .editorconfig
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ └── config.yml
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .spi.yml
├── .swift-version
├── .swiftformat
├── Examples/
│ ├── .swiftpm/
│ │ └── xcode/
│ │ └── package.xcworkspace/
│ │ └── contents.xcworkspacedata
│ ├── Package.swift
│ └── Showcase/
│ ├── Showcase/
│ │ ├── App.swift
│ │ ├── AppView.swift
│ │ ├── Controls.swift
│ │ ├── Helpers.swift
│ │ ├── List.swift
│ │ ├── Navigation.swift
│ │ ├── Presentation.swift
│ │ ├── ScrollView.swift
│ │ ├── Showcase.entitlements
│ │ └── UIViewRepresentable.swift
│ └── Showcase.xcodeproj/
│ ├── project.pbxproj
│ ├── project.xcworkspace/
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata/
│ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata/
│ └── xcschemes/
│ └── Showcase.xcscheme
├── LICENSE
├── Package.swift
├── README.md
├── Sources/
│ ├── Introspect.swift
│ ├── IntrospectableViewType.swift
│ ├── IntrospectionSelector.swift
│ ├── IntrospectionView.swift
│ ├── PlatformVersion.swift
│ ├── PlatformView.swift
│ ├── PlatformViewVersion.swift
│ ├── Utils.swift
│ ├── ViewTypes/
│ │ ├── Button.swift
│ │ ├── ColorPicker.swift
│ │ ├── DatePicker.swift
│ │ ├── DatePickerWithCompactStyle.swift
│ │ ├── DatePickerWithFieldStyle.swift
│ │ ├── DatePickerWithGraphicalStyle.swift
│ │ ├── DatePickerWithStepperFieldStyle.swift
│ │ ├── DatePickerWithWheelStyle.swift
│ │ ├── Form.swift
│ │ ├── FormWithGroupedStyle.swift
│ │ ├── FullScreenCover.swift
│ │ ├── List.swift
│ │ ├── ListCell.swift
│ │ ├── ListWithBorderedStyle.swift
│ │ ├── ListWithGroupedStyle.swift
│ │ ├── ListWithInsetGroupedStyle.swift
│ │ ├── ListWithInsetStyle.swift
│ │ ├── ListWithSidebarStyle.swift
│ │ ├── Map.swift
│ │ ├── NavigationSplitView.swift
│ │ ├── NavigationStack.swift
│ │ ├── NavigationViewWithColumnsStyle.swift
│ │ ├── NavigationViewWithStackStyle.swift
│ │ ├── PageControl.swift
│ │ ├── PickerWithMenuStyle.swift
│ │ ├── PickerWithSegmentedStyle.swift
│ │ ├── PickerWithWheelStyle.swift
│ │ ├── Popover.swift
│ │ ├── ProgressViewWithCircularStyle.swift
│ │ ├── ProgressViewWithLinearStyle.swift
│ │ ├── ScrollView.swift
│ │ ├── SearchField.swift
│ │ ├── SecureField.swift
│ │ ├── Sheet.swift
│ │ ├── SignInWithAppleButton.swift
│ │ ├── Slider.swift
│ │ ├── Stepper.swift
│ │ ├── TabView.swift
│ │ ├── TabViewWithPageStyle.swift
│ │ ├── Table.swift
│ │ ├── TextEditor.swift
│ │ ├── TextField.swift
│ │ ├── TextFieldWithVerticalAxis.swift
│ │ ├── Toggle.swift
│ │ ├── ToggleWithButtonStyle.swift
│ │ ├── ToggleWithCheckboxStyle.swift
│ │ ├── ToggleWithSwitchStyle.swift
│ │ ├── VideoPlayer.swift
│ │ ├── View.swift
│ │ ├── ViewController.swift
│ │ ├── WebView.swift
│ │ └── Window.swift
│ └── Weak.swift
├── SwiftUIIntrospect.podspec
├── SwiftUIIntrospect.xcworkspace/
│ ├── contents.xcworkspacedata
│ └── xcshareddata/
│ ├── IDEWorkspaceChecks.plist
│ ├── WorkspaceSettings.xcsettings
│ └── xcschemes/
│ └── SwiftUIIntrospect.xcscheme
├── Tests/
│ ├── TestFramework/
│ │ └── TestFramework.swift
│ ├── Tests/
│ │ ├── PlatformVersionTests.swift
│ │ ├── TestUtils.swift
│ │ ├── ViewTypes/
│ │ │ ├── ButtonTests.swift
│ │ │ ├── ColorPickerTests.swift
│ │ │ ├── DatePickerTests.swift
│ │ │ ├── DatePickerWithCompactFieldStyleTests.swift
│ │ │ ├── DatePickerWithFieldStyleTests.swift
│ │ │ ├── DatePickerWithGraphicalStyleTests.swift
│ │ │ ├── DatePickerWithStepperFieldStyleTests.swift
│ │ │ ├── DatePickerWithWheelStyleTests.swift
│ │ │ ├── FormTests.swift
│ │ │ ├── FormWithGroupedStyleTests.swift
│ │ │ ├── FullScreenCoverTests.swift
│ │ │ ├── ListCellTests.swift
│ │ │ ├── ListTests.swift
│ │ │ ├── ListWithBorderedStyleTests.swift
│ │ │ ├── ListWithGroupedStyleTests.swift
│ │ │ ├── ListWithInsetGroupedStyleTests.swift
│ │ │ ├── ListWithInsetStyleTests.swift
│ │ │ ├── ListWithPlainStyleTests.swift
│ │ │ ├── ListWithSidebarStyleTests.swift
│ │ │ ├── MapTests.swift
│ │ │ ├── NavigationSplitViewTests.swift
│ │ │ ├── NavigationStackTests.swift
│ │ │ ├── NavigationViewWithColumnsStyleTests.swift
│ │ │ ├── NavigationViewWithStackStyleTests.swift
│ │ │ ├── PageControlTests.swift
│ │ │ ├── PickerWithMenuStyleTests.swift
│ │ │ ├── PickerWithSegmentedStyleTests.swift
│ │ │ ├── PickerWithWheelStyleTests.swift
│ │ │ ├── PopoverTests.swift
│ │ │ ├── ProgressViewWithCircularStyleTests.swift
│ │ │ ├── ProgressViewWithLinearStyleTests.swift
│ │ │ ├── ScrollViewTests.swift
│ │ │ ├── SearchFieldTests.swift
│ │ │ ├── SecureFieldTests.swift
│ │ │ ├── SheetTests.swift
│ │ │ ├── SliderTests.swift
│ │ │ ├── StepperTests.swift
│ │ │ ├── TabViewTests.swift
│ │ │ ├── TabViewWithPageStyleTests.swift
│ │ │ ├── TableTests.swift
│ │ │ ├── TextEditorTests.swift
│ │ │ ├── TextFieldTests.swift
│ │ │ ├── TextFieldWithVerticalAxisTests.swift
│ │ │ ├── ToggleTests.swift
│ │ │ ├── ToggleWithButtonStyleTests.swift
│ │ │ ├── ToggleWithCheckboxStyleTests.swift
│ │ │ ├── ToggleWithSwitchStyleTests.swift
│ │ │ ├── VideoPlayerTests.swift
│ │ │ ├── ViewControllerTests.swift
│ │ │ ├── ViewTests.swift
│ │ │ ├── WebViewTests.swift
│ │ │ └── WindowTests.swift
│ │ └── WeakTests.swift
│ ├── Tests.xcodeproj/
│ │ ├── project.pbxproj
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ ├── SwiftUIIntrospectTestFramework.xcscheme
│ │ └── SwiftUIIntrospectTests.xcscheme
│ ├── Tests.xctestplan
│ └── TestsHostApp/
│ ├── App.swift
│ └── Assets.xcassets/
│ ├── AccentColor.colorset/
│ │ └── Contents.json
│ ├── AppIcon.appiconset/
│ │ └── Contents.json
│ └── Contents.json
└── script/
└── pod_release
Condensed preview — 158 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (479K chars).
[
{
"path": ".editorconfig",
"chars": 335,
"preview": "# EditorConfig is awesome: https://editorconfig.org\n\nroot = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newl"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.yml",
"chars": 2773,
"preview": "name: Bug Report\ndescription: Something isn't working as expected\nlabels: [bug]\nbody:\n- type: markdown\n attributes:\n "
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 323,
"preview": "blank_issues_enabled: false\n\ncontact_links:\n - name: Project Discussion\n url: https://github.com/siteline/swiftui-in"
},
{
"path": ".github/workflows/ci.yml",
"chars": 8956,
"preview": "name: CI\n\non:\n push:\n branches:\n - main\n pull_request:\n branches:\n - \"**\"\n schedule:\n - cron: \"3 3"
},
{
"path": ".gitignore",
"chars": 177,
"preview": ".DS_Store\n/.build\n/.swiftpm\n/Packages\n/*.xcodeproj\nxcuserdata/\nDerivedData/\n.netrc\n\nfastlane/report.xml\nfastlane/Preview"
},
{
"path": ".spi.yml",
"chars": 80,
"preview": "version: 1\nbuilder:\n configs:\n - documentation_targets: [SwiftUIIntrospect]\n"
},
{
"path": ".swift-version",
"chars": 4,
"preview": "6.0\n"
},
{
"path": ".swiftformat",
"chars": 763,
"preview": "# SwiftFormat Configuration File\n# For documentation, see: https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.m"
},
{
"path": "Examples/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata",
"chars": 135,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n version = \"1.0\">\n <FileRef\n location = \"self:\">\n </FileRef"
},
{
"path": "Examples/Package.swift",
"chars": 127,
"preview": "// swift-tools-version:5.4\n\nimport PackageDescription\n\nlet package = Package(\n\tname: \"Examples\",\n\tproducts: [],\n\ttargets"
},
{
"path": "Examples/Showcase/Showcase/App.swift",
"chars": 135,
"preview": "import SwiftUI\n\n@main\nstruct App: SwiftUI.App {\n\tvar body: some Scene {\n\t\tWindowGroup {\n\t\t\tAppView()\n\t\t}\n\t}\n}\n\n#Preview "
},
{
"path": "Examples/Showcase/Showcase/AppView.swift",
"chars": 1969,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\n\nstruct AppView: View {\n\tvar body: some View {\n\t\tContentView()\n\t\t\t#if os(iOS) ||"
},
{
"path": "Examples/Showcase/Showcase/Controls.swift",
"chars": 4969,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\n\nstruct ControlsShowcase: View {\n\t@State private var textFieldValue = \"\"\n\t@State"
},
{
"path": "Examples/Showcase/Showcase/Helpers.swift",
"chars": 588,
"preview": "import SwiftUI\n\nextension View {\n\t/// Modify a view with a `ViewBuilder` closure.\n\t///\n\t/// This represents a streamlini"
},
{
"path": "Examples/Showcase/Showcase/List.swift",
"chars": 2704,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\n\nstruct ListShowcase: View {\n\t@State var receiverListFound: Bool = false\n\t@State"
},
{
"path": "Examples/Showcase/Showcase/Navigation.swift",
"chars": 1438,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\n\nstruct NavigationShowcase: View {\n\tvar body: some View {\n\t\tNavigationView {\n\t\t\t"
},
{
"path": "Examples/Showcase/Showcase/Presentation.swift",
"chars": 2001,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\n\n#if !os(macOS)\nstruct PresentationShowcase: View {\n\t@State var isSheetPresented"
},
{
"path": "Examples/Showcase/Showcase/ScrollView.swift",
"chars": 2036,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\n\nstruct ScrollViewShowcase: View {\n\t@State var receiverScrollViewFound: Bool = f"
},
{
"path": "Examples/Showcase/Showcase/Showcase.entitlements",
"chars": 181,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "Examples/Showcase/Showcase/UIViewRepresentable.swift",
"chars": 2229,
"preview": "import SwiftUI\n@_spi(Internals) import SwiftUIIntrospect\n\nstruct UIViewRepresentableShowcase: View {\n\tlet colors: [Color"
},
{
"path": "Examples/Showcase/Showcase.xcodeproj/project.pbxproj",
"chars": 17546,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 55;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "Examples/Showcase/Showcase.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
"chars": 135,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n version = \"1.0\">\n <FileRef\n location = \"self:\">\n </FileRef"
},
{
"path": "Examples/Showcase/Showcase.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
"chars": 238,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "Examples/Showcase/Showcase.xcodeproj/xcshareddata/xcschemes/Showcase.xcscheme",
"chars": 2849,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n LastUpgradeVersion = \"2600\"\n version = \"1.3\">\n <BuildAction\n "
},
{
"path": "LICENSE",
"chars": 1054,
"preview": "Copyright 2019 Timber Software\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this sof"
},
{
"path": "Package.swift",
"chars": 786,
"preview": "// swift-tools-version:6.0\n\nimport PackageDescription\n\nlet package = Package(\n\tname: \"swiftui-introspect\",\n\tplatforms: ["
},
{
"path": "README.md",
"chars": 18993,
"preview": "SwiftUI Introspect\n=================\n\n[\npublic import SwiftUI\n\n/// The scope of introspection i.e. where introspect should look to find\n/// the"
},
{
"path": "Sources/IntrospectableViewType.swift",
"chars": 791,
"preview": "#if !os(watchOS)\n@MainActor\npublic protocol IntrospectableViewType {\n\t/// The scope of introspection for this particular"
},
{
"path": "Sources/IntrospectionSelector.swift",
"chars": 2324,
"preview": "#if !os(watchOS)\n#if os(iOS) || os(tvOS) || os(visionOS)\npublic import UIKit\n#elseif os(macOS)\npublic import AppKit\n#end"
},
{
"path": "Sources/IntrospectionView.swift",
"chars": 6474,
"preview": "#if !os(watchOS)\nimport SwiftUI\n\ntypealias IntrospectionViewID = UUID\n\n@MainActor\nfileprivate enum IntrospectionStore {\n"
},
{
"path": "Sources/PlatformVersion.swift",
"chars": 7482,
"preview": "#if !os(watchOS)\nimport Foundation\n\n@_spi(Internals)\npublic enum PlatformVersionCondition: Sendable {\n\tcase past\n\tcase c"
},
{
"path": "Sources/PlatformView.swift",
"chars": 2172,
"preview": "#if !os(watchOS)\npublic import SwiftUI\n\n#if canImport(UIKit)\npublic typealias PlatformView = UIView\n#elseif canImport(Ap"
},
{
"path": "Sources/PlatformViewVersion.swift",
"chars": 4718,
"preview": "#if !os(watchOS)\nimport SwiftUI\n\n@MainActor\npublic struct PlatformViewVersionPredicate<SwiftUIViewType: IntrospectableVi"
},
{
"path": "Sources/Utils.swift",
"chars": 703,
"preview": "postfix operator ~\n\npostfix func ~ <T>(lhs: some Any) -> T {\n\tlhs as! T\n}\n\npostfix func ~ <T>(lhs: (some Any)?) -> T? {\n"
},
{
"path": "Sources/ViewTypes/Button.swift",
"chars": 2869,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Button` type in SwiftUI.\n///\n/// ### iOS\n///\n/// Not available.\n"
},
{
"path": "Sources/ViewTypes/ColorPicker.swift",
"chars": 2685,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `ColorPicker` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/"
},
{
"path": "Sources/ViewTypes/DatePicker.swift",
"chars": 2419,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `DatePicker` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n//"
},
{
"path": "Sources/ViewTypes/DatePickerWithCompactStyle.swift",
"chars": 3068,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `DatePicker` type in SwiftUI, with `.compact` style.\n///\n/// ### "
},
{
"path": "Sources/ViewTypes/DatePickerWithFieldStyle.swift",
"chars": 1453,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `DatePicker` type in SwiftUI, with `.field` style.\n///\n/// ### iO"
},
{
"path": "Sources/ViewTypes/DatePickerWithGraphicalStyle.swift",
"chars": 2942,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `DatePicker` type in SwiftUI, with `.graphical` style.\n///\n/// ##"
},
{
"path": "Sources/ViewTypes/DatePickerWithStepperFieldStyle.swift",
"chars": 1502,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `DatePicker` type in SwiftUI, with `.stepperField` style.\n///\n///"
},
{
"path": "Sources/ViewTypes/DatePickerWithWheelStyle.swift",
"chars": 1962,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `DatePicker` type in SwiftUI, with `.wheel` style.\n///\n/// ### iO"
},
{
"path": "Sources/ViewTypes/Form.swift",
"chars": 2558,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Form` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// stru"
},
{
"path": "Sources/ViewTypes/FormWithGroupedStyle.swift",
"chars": 4354,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Form` type in SwiftUI, with `.grouped` style.\n///\n/// ### iOS\n//"
},
{
"path": "Sources/ViewTypes/FullScreenCover.swift",
"chars": 4037,
"preview": "#if !os(watchOS)\n/// An abstract representation of `.fullScreenCover` in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// s"
},
{
"path": "Sources/ViewTypes/List.swift",
"chars": 3403,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `List` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// stru"
},
{
"path": "Sources/ViewTypes/ListCell.swift",
"chars": 3687,
"preview": "#if !os(watchOS)\n/// An abstract representation of a `List` cell type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// s"
},
{
"path": "Sources/ViewTypes/ListWithBorderedStyle.swift",
"chars": 1626,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `List` type in SwiftUI, with `.bordered` style.\n///\n/// ### iOS\n/"
},
{
"path": "Sources/ViewTypes/ListWithGroupedStyle.swift",
"chars": 2916,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `List` type in SwiftUI, with `.grouped` style.\n///\n/// ### iOS\n//"
},
{
"path": "Sources/ViewTypes/ListWithInsetGroupedStyle.swift",
"chars": 2312,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `List` type in SwiftUI, with `.insetGrouped` style.\n///\n/// ### i"
},
{
"path": "Sources/ViewTypes/ListWithInsetStyle.swift",
"chars": 3106,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `List` type in SwiftUI, with `.inset` style.\n///\n/// ### iOS\n///\n"
},
{
"path": "Sources/ViewTypes/ListWithSidebarStyle.swift",
"chars": 3057,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `List` type in SwiftUI, with `.sidebar` style.\n///\n/// ### iOS\n//"
},
{
"path": "Sources/ViewTypes/Map.swift",
"chars": 3710,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Map` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// struc"
},
{
"path": "Sources/ViewTypes/NavigationSplitView.swift",
"chars": 4920,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `NavigationSplitView` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ``"
},
{
"path": "Sources/ViewTypes/NavigationStack.swift",
"chars": 3497,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `NavigationStack` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swi"
},
{
"path": "Sources/ViewTypes/NavigationViewWithColumnsStyle.swift",
"chars": 4369,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `NavigationView` type in SwiftUI, with `.columns` style.\n///\n/// "
},
{
"path": "Sources/ViewTypes/NavigationViewWithStackStyle.swift",
"chars": 3454,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `NavigationView` type in SwiftUI, with `.stack` style.\n///\n/// ##"
},
{
"path": "Sources/ViewTypes/PageControl.swift",
"chars": 3124,
"preview": "#if !os(watchOS)\n/// An abstract representation of the page control type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n//"
},
{
"path": "Sources/ViewTypes/PickerWithMenuStyle.swift",
"chars": 1612,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Picker` type in SwiftUI, with `.menu` style.\n///\n/// ### iOS\n///"
},
{
"path": "Sources/ViewTypes/PickerWithSegmentedStyle.swift",
"chars": 3993,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Picker` type in SwiftUI, with `.segmented` style.\n///\n/// ### iO"
},
{
"path": "Sources/ViewTypes/PickerWithWheelStyle.swift",
"chars": 2142,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Picker` type in SwiftUI, with `.wheel` style.\n///\n/// ### iOS\n//"
},
{
"path": "Sources/ViewTypes/Popover.swift",
"chars": 2698,
"preview": "#if !os(watchOS)\n/// An abstract representation of `.popover` in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// struct Co"
},
{
"path": "Sources/ViewTypes/ProgressViewWithCircularStyle.swift",
"chars": 3714,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `ProgressView` type in SwiftUI, with `.circular` style.\n///\n/// #"
},
{
"path": "Sources/ViewTypes/ProgressViewWithLinearStyle.swift",
"chars": 3622,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `ProgressView` type in SwiftUI, with `.linear` style.\n///\n/// ###"
},
{
"path": "Sources/ViewTypes/ScrollView.swift",
"chars": 2958,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `ScrollView` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n//"
},
{
"path": "Sources/ViewTypes/SearchField.swift",
"chars": 4945,
"preview": "#if !os(watchOS)\n/// An abstract representation of the search field displayed via the `.searchable` modifier in SwiftUI."
},
{
"path": "Sources/ViewTypes/SecureField.swift",
"chars": 3134,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `SecureField` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/"
},
{
"path": "Sources/ViewTypes/Sheet.swift",
"chars": 4524,
"preview": "#if !os(watchOS)\n/// An abstract representation of `.sheet` in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// struct Cont"
},
{
"path": "Sources/ViewTypes/SignInWithAppleButton.swift",
"chars": 2737,
"preview": "#if !os(watchOS)\nimport SwiftUI\n\n/// An abstract representation of the `SignInWithAppleButton` type in SwiftUI.\n///\n/// "
},
{
"path": "Sources/ViewTypes/Slider.swift",
"chars": 1892,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Slider` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// st"
},
{
"path": "Sources/ViewTypes/Stepper.swift",
"chars": 1942,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Stepper` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// s"
},
{
"path": "Sources/ViewTypes/TabView.swift",
"chars": 3801,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `TabView` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// s"
},
{
"path": "Sources/ViewTypes/TabViewWithPageStyle.swift",
"chars": 3327,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `TabView` type in SwiftUI, with `.page` style.\n///\n/// ### iOS\n//"
},
{
"path": "Sources/ViewTypes/Table.swift",
"chars": 4788,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Table` type in SwiftUI, with any style.\n///\n/// ### iOS\n///\n/// "
},
{
"path": "Sources/ViewTypes/TextEditor.swift",
"chars": 2533,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `TextEditor` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n//"
},
{
"path": "Sources/ViewTypes/TextField.swift",
"chars": 3086,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `TextField` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n///"
},
{
"path": "Sources/ViewTypes/TextFieldWithVerticalAxis.swift",
"chars": 4327,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `TextField` type in SwiftUI, with `.vertical` axis.\n///\n/// ### i"
},
{
"path": "Sources/ViewTypes/Toggle.swift",
"chars": 1872,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Toggle` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// st"
},
{
"path": "Sources/ViewTypes/ToggleWithButtonStyle.swift",
"chars": 1813,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Toggle` type in SwiftUI, with `.button` style.\n///\n/// ### iOS\n/"
},
{
"path": "Sources/ViewTypes/ToggleWithCheckboxStyle.swift",
"chars": 1425,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Toggle` type in SwiftUI, with `.checkbox` style.\n///\n/// ### iOS"
},
{
"path": "Sources/ViewTypes/ToggleWithSwitchStyle.swift",
"chars": 2135,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `Toggle` type in SwiftUI, with `.switch` style.\n///\n/// ### iOS\n/"
},
{
"path": "Sources/ViewTypes/VideoPlayer.swift",
"chars": 3401,
"preview": "#if !os(watchOS)\nimport SwiftUI\n\n/// An abstract representation of the `VideoPlayer` type in SwiftUI.\n///\n/// ### iOS\n//"
},
{
"path": "Sources/ViewTypes/View.swift",
"chars": 3559,
"preview": "#if !os(watchOS)\n/// An abstract representation of a generic SwiftUI view type.\n///\n/// Note: prior to iOS 26, primitive"
},
{
"path": "Sources/ViewTypes/ViewController.swift",
"chars": 3414,
"preview": "#if !os(watchOS)\n/// An abstract representation of the receiving SwiftUI view's view controller,\n/// or the closest ance"
},
{
"path": "Sources/ViewTypes/WebView.swift",
"chars": 4516,
"preview": "#if !os(watchOS)\n/// An abstract representation of the `WebView` type in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// s"
},
{
"path": "Sources/ViewTypes/Window.swift",
"chars": 3700,
"preview": "#if !os(watchOS)\n/// An abstract representation of a view's window in SwiftUI.\n///\n/// ### iOS\n///\n/// ```swift\n/// stru"
},
{
"path": "Sources/Weak.swift",
"chars": 290,
"preview": "@_spi(Advanced)\n@propertyWrapper\npublic final class Weak<T: AnyObject> {\n\tprivate weak var _wrappedValue: T? = nil\n\n\tpub"
},
{
"path": "SwiftUIIntrospect.podspec",
"chars": 628,
"preview": "Pod::Spec.new do |spec|\n\tspec.name = 'SwiftUIIntrospect'\n\tspec.version = ENV['LIB_VERSION']\n\tspec.license = { type: 'MIT"
},
{
"path": "SwiftUIIntrospect.xcworkspace/contents.xcworkspacedata",
"chars": 299,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n version = \"1.0\">\n <FileRef\n location = \"group:Examples/Showc"
},
{
"path": "SwiftUIIntrospect.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
"chars": 238,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "SwiftUIIntrospect.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
"chars": 264,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "SwiftUIIntrospect.xcworkspace/xcshareddata/xcschemes/SwiftUIIntrospect.xcscheme",
"chars": 2394,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n LastUpgradeVersion = \"2600\"\n version = \"1.7\">\n <BuildAction\n "
},
{
"path": "Tests/TestFramework/TestFramework.swift",
"chars": 480,
"preview": "internal import SwiftUI\ninternal import SwiftUIIntrospect\n\nstruct TestView: View {\n\tvar body: some View {\n\t\tText(\"Hello,"
},
{
"path": "Tests/Tests/PlatformVersionTests.swift",
"chars": 18663,
"preview": "@_spi(Internals) import SwiftUIIntrospect\nimport Testing\n\n@Suite\nstruct PlatformVersionTests {\n\t@Test func iOS_isCurrent"
},
{
"path": "Tests/Tests/TestUtils.swift",
"chars": 6060,
"preview": "import SwiftUI\nimport Testing\n\n#if canImport(UIKit)\n@MainActor\nenum TestUtils {\n\t#if targetEnvironment(macCatalyst) || o"
},
{
"path": "Tests/Tests/ViewTypes/ButtonTests.swift",
"chars": 1690,
"preview": "#if !os(iOS) && !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstr"
},
{
"path": "Tests/Tests/ViewTypes/ColorPickerTests.swift",
"chars": 1872,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ColorPickerTests {\n\t#if c"
},
{
"path": "Tests/Tests/ViewTypes/DatePickerTests.swift",
"chars": 1939,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct DatePickerTests {\n\t#if ca"
},
{
"path": "Tests/Tests/ViewTypes/DatePickerWithCompactFieldStyleTests.swift",
"chars": 2183,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct DatePickerWithCompactStyl"
},
{
"path": "Tests/Tests/ViewTypes/DatePickerWithFieldStyleTests.swift",
"chars": 1302,
"preview": "#if !os(iOS) && !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstr"
},
{
"path": "Tests/Tests/ViewTypes/DatePickerWithGraphicalStyleTests.swift",
"chars": 2232,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct DatePickerWithGraphicalSt"
},
{
"path": "Tests/Tests/ViewTypes/DatePickerWithStepperFieldStyleTests.swift",
"chars": 1365,
"preview": "#if !os(iOS) && !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite str"
},
{
"path": "Tests/Tests/ViewTypes/DatePickerWithWheelStyleTests.swift",
"chars": 1373,
"preview": "#if !os(tvOS) && !os(macOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@"
},
{
"path": "Tests/Tests/ViewTypes/FormTests.swift",
"chars": 1151,
"preview": "#if !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct FormTests {\n\t#if canImpo"
},
{
"path": "Tests/Tests/ViewTypes/FormWithGroupedStyleTests.swift",
"chars": 1521,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct FormWithGroupedStyleTests {\n\t#if canImp"
},
{
"path": "Tests/Tests/ViewTypes/FullScreenCoverTests.swift",
"chars": 573,
"preview": "#if !os(macOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Su"
},
{
"path": "Tests/Tests/ViewTypes/ListCellTests.swift",
"chars": 1497,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ListCellTests {\n\t#if canImport(UIKit)\n\t"
},
{
"path": "Tests/Tests/ViewTypes/ListTests.swift",
"chars": 3409,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ListTests {\n\t#if canImport(UIKit)\n\ttype"
},
{
"path": "Tests/Tests/ViewTypes/ListWithBorderedStyleTests.swift",
"chars": 792,
"preview": "#if !os(iOS) && !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstr"
},
{
"path": "Tests/Tests/ViewTypes/ListWithGroupedStyleTests.swift",
"chars": 1107,
"preview": "#if !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ListWithGroupedStyleTest"
},
{
"path": "Tests/Tests/ViewTypes/ListWithInsetGroupedStyleTests.swift",
"chars": 1055,
"preview": "#if !os(tvOS) && !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ListWithIns"
},
{
"path": "Tests/Tests/ViewTypes/ListWithInsetStyleTests.swift",
"chars": 1449,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ListWithInsetStyleTests {"
},
{
"path": "Tests/Tests/ViewTypes/ListWithPlainStyleTests.swift",
"chars": 1580,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ListWithPlainStyleTests {\n\t#if canImpor"
},
{
"path": "Tests/Tests/ViewTypes/ListWithSidebarStyleTests.swift",
"chars": 1491,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ListWithSidebarStyleTests"
},
{
"path": "Tests/Tests/ViewTypes/MapTests.swift",
"chars": 1405,
"preview": "#if canImport(MapKit)\nimport MapKit\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct Map"
},
{
"path": "Tests/Tests/ViewTypes/NavigationSplitViewTests.swift",
"chars": 2278,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct NavigationSplitViewTests {\n\t#if canImpo"
},
{
"path": "Tests/Tests/ViewTypes/NavigationStackTests.swift",
"chars": 965,
"preview": "#if !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct NavigationStackTests {\n\t"
},
{
"path": "Tests/Tests/ViewTypes/NavigationViewWithColumnsStyleTests.swift",
"chars": 2489,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct NavigationViewWithColumnsStyleTests {\n\t"
},
{
"path": "Tests/Tests/ViewTypes/NavigationViewWithStackStyleTests.swift",
"chars": 1115,
"preview": "#if !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct NavigationViewWithStackS"
},
{
"path": "Tests/Tests/ViewTypes/PageControlTests.swift",
"chars": 695,
"preview": "#if !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct PageControlTests {\n\ttype"
},
{
"path": "Tests/Tests/ViewTypes/PickerWithMenuStyleTests.swift",
"chars": 1248,
"preview": "#if !os(iOS) && !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstr"
},
{
"path": "Tests/Tests/ViewTypes/PickerWithSegmentedStyleTests.swift",
"chars": 2375,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct PickerWithSegmentedStyleTests {\n\t#if ca"
},
{
"path": "Tests/Tests/ViewTypes/PickerWithWheelStyleTests.swift",
"chars": 1605,
"preview": "#if !os(tvOS) && !os(macOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@"
},
{
"path": "Tests/Tests/ViewTypes/PopoverTests.swift",
"chars": 532,
"preview": "#if !os(tvOS) && !os(macOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@"
},
{
"path": "Tests/Tests/ViewTypes/ProgressViewWithCircularStyleTests.swift",
"chars": 2032,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ProgressViewWithCircularStyleTests {\n\t#"
},
{
"path": "Tests/Tests/ViewTypes/ProgressViewWithLinearStyleTests.swift",
"chars": 2131,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ProgressViewWithLinearStyleTests {\n\t#if"
},
{
"path": "Tests/Tests/ViewTypes/ScrollViewTests.swift",
"chars": 4295,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ScrollViewTests {\n\t#if canImport(UIKit)"
},
{
"path": "Tests/Tests/ViewTypes/SearchFieldTests.swift",
"chars": 5850,
"preview": "#if !os(macOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Su"
},
{
"path": "Tests/Tests/ViewTypes/SecureFieldTests.swift",
"chars": 3849,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct SecureFieldTests {\n\t#if canImport(UIKit"
},
{
"path": "Tests/Tests/ViewTypes/SheetTests.swift",
"chars": 1596,
"preview": "#if !os(macOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Su"
},
{
"path": "Tests/Tests/ViewTypes/SliderTests.swift",
"chars": 1662,
"preview": "#if !os(tvOS) && !os(visionOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing"
},
{
"path": "Tests/Tests/ViewTypes/StepperTests.swift",
"chars": 1501,
"preview": "#if !os(tvOS) && !os(visionOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing"
},
{
"path": "Tests/Tests/ViewTypes/TabViewTests.swift",
"chars": 2561,
"preview": "#if !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct TabViewTests {\n\t#if c"
},
{
"path": "Tests/Tests/ViewTypes/TabViewWithPageStyleTests.swift",
"chars": 1254,
"preview": "#if !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct TabViewWithPageStyleTest"
},
{
"path": "Tests/Tests/ViewTypes/TableTests.swift",
"chars": 3790,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct TableTests {\n\t#if canImpo"
},
{
"path": "Tests/Tests/ViewTypes/TextEditorTests.swift",
"chars": 1798,
"preview": "#if !os(tvOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct TextEditorTests {\n\t#if ca"
},
{
"path": "Tests/Tests/ViewTypes/TextFieldTests.swift",
"chars": 3767,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct TextFieldTests {\n\t#if canImport(UIKit)\n"
},
{
"path": "Tests/Tests/ViewTypes/TextFieldWithVerticalAxisTests.swift",
"chars": 2401,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct TextFieldWithVerticalAxisTests {\n\t#if c"
},
{
"path": "Tests/Tests/ViewTypes/ToggleTests.swift",
"chars": 1585,
"preview": "#if !os(tvOS) && !os(visionOS) && !targetEnvironment(macCatalyst)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing"
},
{
"path": "Tests/Tests/ViewTypes/ToggleWithButtonStyleTests.swift",
"chars": 1031,
"preview": "#if !os(iOS) && !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstr"
},
{
"path": "Tests/Tests/ViewTypes/ToggleWithCheckboxStyleTests.swift",
"chars": 1062,
"preview": "#if !os(iOS) && !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstr"
},
{
"path": "Tests/Tests/ViewTypes/ToggleWithSwitchStyleTests.swift",
"chars": 1787,
"preview": "#if !os(tvOS) && !os(visionOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ToggleWi"
},
{
"path": "Tests/Tests/ViewTypes/VideoPlayerTests.swift",
"chars": 2111,
"preview": "#if canImport(AVKit)\nimport AVKit\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct Video"
},
{
"path": "Tests/Tests/ViewTypes/ViewControllerTests.swift",
"chars": 1357,
"preview": "#if !os(macOS)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ViewControllerTests {\n\t@"
},
{
"path": "Tests/Tests/ViewTypes/ViewTests.swift",
"chars": 2226,
"preview": "import SwiftUI\n@_spi(Internals) import SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct ViewTests {\n\t@Test fun"
},
{
"path": "Tests/Tests/ViewTypes/WebViewTests.swift",
"chars": 910,
"preview": "#if canImport(WebKit)\nimport SwiftUI\nimport SwiftUIIntrospect\nimport Testing\nimport WebKit\n\n@MainActor\n@Suite\nstruct Web"
},
{
"path": "Tests/Tests/ViewTypes/WindowTests.swift",
"chars": 1588,
"preview": "import SwiftUI\nimport SwiftUIIntrospect\nimport Testing\n\n@MainActor\n@Suite\nstruct WindowTests {\n\t#if canImport(UIKit)\n\tty"
},
{
"path": "Tests/Tests/WeakTests.swift",
"chars": 1144,
"preview": "@_spi(Advanced) import SwiftUIIntrospect\nimport Testing\n\n@Suite\nstruct WeakTests {\n\tfinal class Foo {}\n\n\tvar strongFoo: "
},
{
"path": "Tests/Tests.xcodeproj/project.pbxproj",
"chars": 34100,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 77;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "Tests/Tests.xcodeproj/xcshareddata/xcschemes/SwiftUIIntrospectTestFramework.xcscheme",
"chars": 2442,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n LastUpgradeVersion = \"2600\"\n version = \"1.7\">\n <BuildAction\n "
},
{
"path": "Tests/Tests.xcodeproj/xcshareddata/xcschemes/SwiftUIIntrospectTests.xcscheme",
"chars": 2047,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n LastUpgradeVersion = \"2600\"\n version = \"1.7\">\n <BuildAction\n "
},
{
"path": "Tests/Tests.xctestplan",
"chars": 484,
"preview": "{\n \"configurations\" : [\n {\n \"id\" : \"BFDC7AD2-E943-4590-B54A-FAEEBCE74E0D\",\n \"name\" : \"Test Scheme Action\","
},
{
"path": "Tests/TestsHostApp/App.swift",
"chars": 112,
"preview": "import SwiftUI\n\n@main\nstruct App: SwiftUI.App {\n\tvar body: some Scene {\n\t\tWindowGroup {\n\t\t\tEmptyView()\n\t\t}\n\t}\n}\n"
},
{
"path": "Tests/TestsHostApp/Assets.xcassets/AccentColor.colorset/Contents.json",
"chars": 123,
"preview": "{\n \"colors\" : [\n {\n \"idiom\" : \"universal\"\n }\n ],\n \"info\" : {\n \"author\" : \"xcode\",\n \"version\" : 1\n }"
},
{
"path": "Tests/TestsHostApp/Assets.xcassets/AppIcon.appiconset/Contents.json",
"chars": 1429,
"preview": "{\n \"images\" : [\n {\n \"idiom\" : \"universal\",\n \"platform\" : \"ios\",\n \"size\" : \"1024x1024\"\n },\n {\n "
},
{
"path": "Tests/TestsHostApp/Assets.xcassets/Contents.json",
"chars": 63,
"preview": "{\n \"info\" : {\n \"author\" : \"xcode\",\n \"version\" : 1\n }\n}\n"
},
{
"path": "script/pod_release",
"chars": 197,
"preview": "#!/usr/bin/env bash\n\nexport LIB_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)\n\necho \"Publishing ver"
}
]
About this extraction
This page contains the full source code of the siteline/swiftui-introspect GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 158 files (423.3 KB), approximately 135.9k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.