Inspect

0.0.1

This package provides introspected views that can be used to inspect the underlying *Kit element of a SwiftUI view.
0xWDG/Inspect

What's New

0.0.1

2024-07-23T17:37:25Z

Inspect allows you to get the underlying *Kit element of a SwiftUI view.

Inspect

SwiftUI Inspect allows you to get the underlying *Kit element of a SwiftUI view.

Swift Package Manager License

Requirements

  • Swift 5.9+ (Xcode 15+)
  • iOS 13+, macOS 10.15+

Installation (Pakage.swift)

dependencies: [
    .package(url: "https://github.com/0xWDG/Inspect.git", .branch("main")),
],
targets: [
    .target(name: "MyTarget", dependencies: [
        .product(name: "Inspect", package: "Inspect"),
    ]),
]

Installation (Xcode)

  1. In Xcode, open your project and navigate to FileSwift PackagesAdd Package Dependency...
  2. Paste the repository URL (https://github.com/0xWDG/Inspect) and click Next.
  3. Click Finish.

Usage

Example to read a ImageView (Multi platform):

import SwiftUI
import Inspect

struct ContentView: View {
#if os(macOS)
    let PlatfornImageView = NSImageView.self
#else
    let PlatfornImageView = UIImageView.self
#endif

    var body: some View {
        VStack {
            Image(systemName: "star")
                .inspect(PlatfornImageView) { view in
                    print(view)
                }
        }
        .padding()
    }
}

Example to read a View Controller (iOS):

    var body: some View {
        List {
            Text("Item 1")
            Text("Item 2")
            Text("Item 3")
            Text("Item 4")
            Text("Item 5")
        }
        .inspectVC({ $0.tabBarController }) { view
            print(view)
        }
        .padding()
    }
}

Contact

We can get in touch via Twitter/X, Discord, Mastodon, Email, Website.

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun May 04 2025 01:18:42 GMT-0900 (Hawaii-Aleutian Daylight Time)