Skip to content

Releases

0.9.2

Choose a tag to compare

@tareksabry1337 tareksabry1337 released this 19 Nov 18:59
  • 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. --verbose lists 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

Choose a tag to compare

@tareksabry1337 tareksabry1337 released this 19 Nov 18:08

Snagless now finds crashes it used to miss:

  • Views shown from your own Scene types, such as struct MainScene: Scene.
  • Views and apps whose View or App conformance, or whose body, is in an extension.
  • Values injected as optionals. .environment(cart) with a Cart? that is still nil crashes the view that reads Cart, so an optional now counts as provided only after if let, guard let or !.

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

Choose a tag to compare

@tareksabry1337 tareksabry1337 released this 19 Nov 09:19

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.