Repository navigation
Releases
0.9.2
- A package checked on its own, with no App, widget or hosting root, now gets one warning for its unchecked views instead of one per view, placed at the first of them:
`StatusDetailView` and 21 other views that read the environment are unchecked; run Snagless on the app that shows them.--verboselists them. - With
--previews off, views that only previews show now count as unchecked, since their problems aren't reported in that mode. - The README's Limits section adds destinations inside a
NavigationView, which never present on iOS 27 but are still checked. The roadmap adds top-level functions that return an optional.
0.9.1
Snagless now finds crashes it used to miss:
- Views shown from your own
Scenetypes, such asstruct MainScene: Scene. - Views and apps whose
VieworAppconformance, or whosebody, is in an extension. - Values injected as optionals.
.environment(cart)with aCart?that is stillnilcrashes the view that readsCart, so an optional now counts as provided only afterif let,guard letor!.
A view that reads from the environment but that no App, preview or hosting root shows now gets a warning, and the summary line counts these as unchecked views. Warnings leave the build passing.
The README's Limits section lists three new known misses: provider extensions matched by name, app delegates credited to every App, and destinations inside a NavigationSplitView.
0.9.0
First release of Snagless, a build-time check for SwiftUI environment crashes.
A view that reads @Environment(Cart.self) or an @EnvironmentObject that nothing above it provides crashes the app, and the compiler lets it through. Snagless reads your source and fails the build at the line that shows the view:
ShopApp.swift:26:13: error: `CartBadge` needs `Cart`: App `ShopApp` → ContentView → CartBadge (ShopApp.swift:6)
Add it as a build tool plugin to a Swift package or an Xcode project, or run the snagless command line tool. The plugin uses the prebuilt macOS binary attached here, so it skips compiling swift-syntax.
See the README for setup, what it checks, and its limits.