https://github.com/0xwdg/inspect
This package provides introspected views that can be used to inspect the underlying *Kit element of a SwiftUI view.
https://github.com/0xwdg/inspect
0xwdg hacktoberfest inspect introspect spm swift swiftlang swiftui
Last synced: 3 months ago
JSON representation
This package provides introspected views that can be used to inspect the underlying *Kit element of a SwiftUI view.
- Host: GitHub
- URL: https://github.com/0xwdg/inspect
- Owner: 0xWDG
- License: mit
- Created: 2024-07-22T22:40:26.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-20T20:17:38.000Z (4 months ago)
- Last Synced: 2025-03-10T13:56:17.429Z (3 months ago)
- Topics: 0xwdg, hacktoberfest, inspect, introspect, spm, swift, swiftlang, swiftui
- Language: Swift
- Homepage: https://0xwdg.github.io/Inspect/
- Size: 303 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Inspect
This package provides introspected views that can be used to inspect the underlying \*Kit element of a SwiftUI view.
[](https://swiftpackageindex.com/0xWDG/Inspect)
[](https://swiftpackageindex.com/0xWDG/Inspect)
[](https://swift.org/package-manager)
## Requirements
- Swift 5.9+ (Xcode 15+)
- iOS 13+, macOS 10.15+## Installation (Pakage.swift)
```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 **File** โ **Swift Packages** โ **Add 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):
```swift
import SwiftUI
import Inspectstruct ContentView: View {
#if os(macOS)
let PlatformImageView = NSImageView.self
#else
let PlatformImageView = UIImageView.self
#endifvar body: some View {
VStack {
Image(systemName: "star")
.inspect(PlatformImageView) { view in
print(view)
}
}
.padding()
}
}
```Example to read a View Controller (iOS):
```swift
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
๐ฆ [@0xWDG](https://bsky.app/profile/0xWDG.bsky.social)
๐ [mastodon.social/@0xWDG](https://mastodon.social/@0xWDG)
๐ฆ [@0xWDG](https://x.com/0xWDG)
๐งต [@0xWDG](https://www.threads.net/@0xWDG)
๐ [wesleydegroot.nl](https://wesleydegroot.nl)
๐ค [Discord](https://discordapp.com/users/918438083861573692)Interested learning more about Swift? [Check out my blog](https://wesleydegroot.nl/blog/).