This one is about finding dead code in a Swift app, and in particular one kind of dead code that the usual tools can't see at all, a TCA (The Composable Architecture) action that has a reducer arm handling it but that nothing in the app ever sends. I ran into it on a personal iOS app (SwiftUI, TCA and a Rust core, about 4,700 Swift files once tests are counted), where a fix had been moved into exactly such an arm and so never ran, and I wanted a periodic sweep over the whole program that would report actions like that before anyone builds on them.
Why "no references" isn't enough
The shape of the problem looks like this:
struct Item : Equatable { }
@Reducer struct ItemsFeature { @ObservableState struct State : Equatable { var items : [ Item ] = [ ] }
enum Action { case itemsLoaded ( [ Item ] ) case addItem ( Item ) // nothing sends this }
var body : some ReducerOf < Self > { Reduce { state , action in switch action { case let . itemsLoaded ( items ) : state . items = items return . none case let .…