A Formal Specification of SwiftUI's Identity Model

A Formal Specification of SwiftUI's Identity Model

An abstract representation of SwiftUI’s view-identity tree. Image by kjpargeter on Magnific.

Five years into SwiftUI, the rules that determine when a view is ‘the same view’ across renders have stabilized — but they have never been formally specified. I encoded them in TLA+ and let the model checker hunt for surprises. It found four cases where SwiftUI’s actual behavior contradicts what a careful engineer would assume, each backed by a runnable reproduction.

Pagination


© Gerald Oluoch 2026. All rights reserved.