{"id":30719849,"url":"https://github.com/dankinsoid/swift-uiinspector","last_synced_at":"2025-09-03T10:42:26.522Z","repository":{"id":294857585,"uuid":"988305791","full_name":"dankinsoid/swift-uiinspector","owner":"dankinsoid","description":"Runtime ui inspector","archived":false,"fork":false,"pushed_at":"2025-06-20T10:50:52.000Z","size":172,"stargazers_count":33,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-06T05:48:52.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dankinsoid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-22T11:00:36.000Z","updated_at":"2025-07-31T01:22:11.000Z","dependencies_parsed_at":"2025-05-29T13:27:29.698Z","dependency_job_id":null,"html_url":"https://github.com/dankinsoid/swift-uiinspector","commit_stats":null,"previous_names":["dankinsoid/swift-uiinspector"],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/dankinsoid/swift-uiinspector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2Fswift-uiinspector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2Fswift-uiinspector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2Fswift-uiinspector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2Fswift-uiinspector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dankinsoid","download_url":"https://codeload.github.com/dankinsoid/swift-uiinspector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2Fswift-uiinspector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273431361,"owners_count":25104491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-03T10:42:25.643Z","updated_at":"2025-09-03T10:42:26.496Z","avatar_url":"https://github.com/dankinsoid.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UIInspector\n\nUIInspector is a debugging tool for iOS apps that allows you to inspect and analyze UI elements at runtime. It provides a visual inspector that can be overlaid on top of your app to examine view hierarchies, measure dimensions, and pick colors.\n\n## Features\n\n- 📏 **Dimension Measurement**: Measure distance between any points\n- 🔍 **View Hierarchy Inspection**: Visualize your app's view hierarchy\n- 🎨 **Color Picker**: Extract colors from any pixel in your UI\n- 📊 **Detailed Properties**: View detailed information about UI components\n- 📐 **Grid Overlay**: Enable grid lines for precise alignment\n\nThis tool is particularly useful for:\n\n- Debugging layout directly in XCode preview without needing to run the app\n- Design reviews and testing\n- As a simple alternative to Xcode's built-in inspector and other UI debugging tools\n- IDE agnostic, works directly in your app\n\n## Requirements\n\n- iOS 13.0+\n- Swift 5.9+\n- Xcode 15.0+\n\n## Installation\n\n### Swift Package Manager\n\nAdd the following to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/dankinsoid/swift-uiinspector.git\", from: \"1.2.1\")\n]\n```\n\nOr add it directly in Xcode using File \u003e Add Packages...\n\n## Example\n\n\u003cimg src=\"https://github.com/dankinsoid/Resources/raw/main/SwiftUIInspector/example.gif\" width=\"300\"\u003e\n\n## Usage\n\n```swift\nimport SwiftUIInspector\n\n// Present the inspector over your current view\nUIInspectorController.present()\n\n// Or present it for a specific view\nUIInspectorController.present(for: myView)\n\n// Customize the inspector\nUIInspectorController.present { inspector in\n    inspector.tintColor = .systemBlue\n    inspector.customInfoView = { view in\n        AnyView(\n            Text(\"Custom info for \\(type(of: view))\")\n        )\n    }\n}\n```\n\nYou can use the following gestures:\n- **Drag**: Measure dimensions or pick colors. Also can be used to move the controls.\n- **Pinch**: Zoom in/out to adjust the inspector view.\n- **Tap**: Show a detailed info of the view, enabled when layers are visible.\n\nNote that the inspector behaves differently when running in a simulator versus on a physical device.\nOn a physical device, it's designed to be used with gestures like pan and pinch, while in the simulator you can use mouse clicks and drags.\nOn a physical device, most drag gestures require a short (0.1s) press to start in order to avoid conflicts with scrolling.\nAdditionally, the simulator includes a zoom button.\n\nFor me I found very comfortable to enable 3-finger drag:\n\n1. System Preferences \u003e Accessibility\n2. Scroll down to `Motor` and tap `Pointer Control` options\n3. Select `Trackpad Options`\n4. Find `Dragging Style` section\n5. Select `Three Finger Drag` from the drop-down\n\n### Xcode Preview integration\nTo use the inspector in Xcode Previews, you can add the following modifier to your SwiftUI previews:\n\n```swift\nimport SwiftUIInspector\nimport SwiftUI\n\n#Preview {\n    Text(\"Hello, World!\")\n        .previewInspector()\n}\n```\nThis modifier adds a button that shows the inspector.\n\n## SwiftUI \nTo show the inspector for the specific view, you can use the `inspector(isPresented)` modifier in your SwiftUI views.\n\n```swift\nimport SwiftUI\nimport SwiftUIInspector\n\nstruct ContentView: View {\n    @State private var showInspector = false\n\n    var body: some View {\n        VStack {\n            Text(\"Hello, World!\")\n                .padding()\n        }\n        .inspector($showInspector)\n        .onAppear {\n            // Automatically present the inspector when the view appears\n            showInspector = true\n        }\n    }\n}\n```\n\n## Inspector Controls\n\nThe inspector provides several controls:\n- **Layers**: Toggle visibility of the view hierarchy layers\n- **Tool**: Switch between color picker and dimension measurement tools\n- **Grid**: Toggle grid overlay for alignment\n- **Refresh**: Update the inspector view\n- **Close**: Dismiss the inspector\n\n## TODO\n\n- **macOS Support**: Currently, the inspector is designed for iOS. Future versions may include support for macOS.\n- **CATransform3D Support**: Enhancements to support 3D Z-axis transformations in the inspector.\n\n## License\n\nThis package is available under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankinsoid%2Fswift-uiinspector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdankinsoid%2Fswift-uiinspector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankinsoid%2Fswift-uiinspector/lists"}