We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 19f033d + 0ab2c56 commit b5a2477Copy full SHA for b5a2477
Sources/Orbit/Support/Environment Keys/Identifier.swift
@@ -41,4 +41,15 @@ public struct IDPreferenceKey: PreferenceKey {
41
public struct IDPreference: Equatable {
42
let id: AnyHashable
43
let bounds: Anchor<CGRect>
44
+
45
+ // `Anchor` is only conditionally `Equatable` since iOS 15.
46
+ // If synthesized, the compiler doesn't see any issues and this leads to a runtime crash on earlier iOS versions.
47
+ // That's why this is written here explicitly.
48
+ public static func == (lhs: IDPreference, rhs: IDPreference) -> Bool {
49
+ if #available(iOS 15, *) {
50
+ return lhs.id == rhs.id && lhs.bounds == rhs.bounds
51
+ } else {
52
+ return lhs.id == rhs.id
53
+ }
54
55
}
0 commit comments