Skip to content
Khoa Pham@onmyway133

How to use EquatableView in SwiftUI

1 min read

From John Harper ’s tweet

SwiftUI assumes any Equatable.== is a true equality check, so for POD views it compares each field directly instead (via reflection). For non-POD views it prefers the view’s == but falls back to its own field compare if no ==. EqView is a way to force the use of ==.

When it does the per-field comparison the same rules are applied recursively to each field (to choose direct comparison or == if defined). (POD = plain data, see Swift’s _isPOD() function.)

Read more

Keep reading

Type to search titles and full text.

↑ ↓ move↵ openPagefind