# \#equatable

**URL:** https://forums.swift.org/tag/equatable/430.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [\[Pitch\] PredicateExpressions API for nil comparisons without Equatable conformance within #Predicates](https://forums.swift.org/t/pitch-predicateexpressions-api-for-nil-comparisons-without-equatable-conformance-within-predicates/88338)

<div class="topic-metadata">

**Author:** [@matthewturk](https://forums.swift.org/u/matthewturk)\
**Replies:** 0\
**Last updated:** [July 16, 2026, 5:22pm UTC](https://forums.swift.org/t/pitch-predicateexpressions-api-for-nil-comparisons-without-equatable-conformance-within-predicates/88338 "2026-07-16T17:22:44Z")

</div>

Dear Swift community, Earlier this year, I proposed four new builder functions in PredicateExpressions to better align #Predicate semantics with Swift writ large. However, they all rely on overloading and can strain the…

---

## [\[Pitch\] Support for nil comparisons without Equatable conformance](https://forums.swift.org/t/pitch-support-for-nil-comparisons-without-equatable-conformance/84684)

<div class="topic-metadata">

**Author:** [@matthewturk](https://forums.swift.org/u/matthewturk)\
**Replies:** 2\
**Last updated:** [February 11, 2026, 9:06pm UTC](https://forums.swift.org/t/pitch-support-for-nil-comparisons-without-equatable-conformance/84684 "2026-02-11T21:06:26Z")

</div>

Dear Swift community, Please find below a pitch that I’ve developed to address swiftlang/swift-foundation#711. If you have questions, comments, or concerns, feel free to let me know. Support for nil comparisons withou…

---

## [Equality in Set in Swift](https://forums.swift.org/t/equality-in-set-in-swift/80246)

<div class="topic-metadata">

**Author:** [@supermage](https://forums.swift.org/u/supermage)\
**Replies:** 4\
**Last updated:** [June 2, 2025, 6:02pm UTC](https://forums.swift.org/t/equality-in-set-in-swift/80246 "2025-06-02T18:02:05Z")

</div>

I have a type called FeildType which is Equatable , Hashable, Identifiable. I use a type called UniqueID as my identifier which is defined as below: public struct UniqueID: Hashable , Equatable , Sendable { pu…

---

## [Checking equality of key paths not working as I expected](https://forums.swift.org/t/checking-equality-of-key-paths-not-working-as-i-expected/76594)

<div class="topic-metadata">

**Author:** [@jeremyabannister](https://forums.swift.org/u/jeremyabannister)\
**Replies:** 2\
**Last updated:** [December 13, 2024, 2:18pm UTC](https://forums.swift.org/t/checking-equality-of-key-paths-not-working-as-i-expected/76594 "2024-12-13T14:18:07Z")

</div>

I ran into somewhat unexpected behavior when trying to compare key paths for equality. My best guess is that the key path that I'm passing into the doSomething(with:) method references the concrete type's implementation,…

---

## [Fuzzy Equatable protocol](https://forums.swift.org/t/fuzzy-equatable-protocol/74295)

<div class="topic-metadata">

**Author:** [@ibex](https://forums.swift.org/u/ibex)\
**Replies:** 0\
**Last updated:** [August 31, 2024, 12:55pm UTC](https://forums.swift.org/t/fuzzy-equatable-protocol/74295 "2024-08-31T12:55:17Z")

</div>

What does the protocol for fuzzy equality look like? Here is my tinkering with it for reference types. :slight\_smile: enum Fuzzy { case yes, no, maybe (probability: Double) protocol Equatable: AnyObject { …

---

## [How does Swift determine \`AnyClass\` equality?](https://forums.swift.org/t/how-does-swift-determine-anyclass-equality/73247)

<div class="topic-metadata">

**Author:** [@nmgswift](https://forums.swift.org/u/nmgswift)\
**Replies:** 2\
**Last updated:** [July 17, 2024, 11:08pm UTC](https://forums.swift.org/t/how-does-swift-determine-anyclass-equality/73247 "2024-07-17T23:08:39Z")

</div>

I've been playing around, trying to understand the internals of the Swift runtime, and I am curious to understand how it determines the equality of AnyClass variables. I see that AnyClass is a type alias for AnyObject.Ty…

---

## [Role of \`Equatable\` conformance when inserting element inside a \`Set\`](https://forums.swift.org/t/role-of-equatable-conformance-when-inserting-element-inside-a-set/69449)

<div class="topic-metadata">

**Author:** [@NicFontana](https://forums.swift.org/u/NicFontana)\
**Replies:** 6\
**Last updated:** [January 15, 2024, 4:18pm UTC](https://forums.swift.org/t/role-of-equatable-conformance-when-inserting-element-inside-a-set/69449 "2024-01-15T16:18:15Z")

</div>

Hi all, I am playing around with this sample code inside a Playground: import Foundation struct Operation: Hashable { let subject: String let type: OperationType init(subject: String, type: OperationT…

---

## [Type '(Int, ())' cannot conform to 'Equatable'](https://forums.swift.org/t/type-int-cannot-conform-to-equatable/69125)

<div class="topic-metadata">

**Author:** [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Replies:** 6\
**Last updated:** [December 22, 2023, 6:35pm UTC](https://forums.swift.org/t/type-int-cannot-conform-to-equatable/69125 "2023-12-22T18:35:34Z")

</div>

After SE283, we have Equatable support for tuple so that (Int, Int) can conform to Equatable. However since () does not conform to Equatable, we'll still be stuck here. See real world example from OpenCombine XCTAsser…

---

## [My unit test is keep crashing because struct that conformed to Equable has a outlined retain and it was released](https://forums.swift.org/t/my-unit-test-is-keep-crashing-because-struct-that-conformed-to-equable-has-a-outlined-retain-and-it-was-released/65696)

<div class="topic-metadata">

**Author:** [@sunlexy](https://forums.swift.org/u/sunlexy)\
**Replies:** 11\
**Last updated:** [July 26, 2023, 10:31am UTC](https://forums.swift.org/t/my-unit-test-is-keep-crashing-because-struct-that-conformed-to-equable-has-a-outlined-retain-and-it-was-released/65696 "2023-07-26T10:31:53Z")

</div>

Hey Folks What I have done is only added an option Int to the EventModel.AppliedFilters. And it causes a chain of crash on my CI in different tests of different files. Xcode 14.3 swift 5.8 I have been keeping having c…

---

## [Allow Equtable to be used in other files especially in Test files](https://forums.swift.org/t/allow-equtable-to-be-used-in-other-files-especially-in-test-files/63497)

<div class="topic-metadata">

**Author:** [@Inder](https://forums.swift.org/u/Inder)\
**Replies:** 5\
**Last updated:** [March 7, 2023, 9:45am UTC](https://forums.swift.org/t/allow-equtable-to-be-used-in-other-files-especially-in-test-files/63497 "2023-03-07T09:45:28Z")

</div>

The problem In unit tests I want to compare my two objects if they are equal, but for that I have to mark my struct with Equatable protocol in the main app target which in fact is not requited in the main app. I can't …

---

## [\[Pitch\] Remove automatic Equatable conformance for NSObjects](https://forums.swift.org/t/pitch-remove-automatic-equatable-conformance-for-nsobjects/57583)

<div class="topic-metadata">

**Author:** [@Logan\_Shire](https://forums.swift.org/u/Logan_Shire)\
**Replies:** 3\
**Last updated:** [May 26, 2022, 12:38am UTC](https://forums.swift.org/t/pitch-remove-automatic-equatable-conformance-for-nsobjects/57583 "2022-05-26T00:38:40Z")

</div>

The documentation for the Swift Equatable protocol states that it is: A type that can be compared for value equality. However, NSObjects implement the Equatable protocol by default using their isEqual method via an e…

---

## [Set Uniqueness of instances with the same hashValue](https://forums.swift.org/t/set-uniqueness-of-instances-with-the-same-hashvalue/45235)

<div class="topic-metadata">

**Author:** [@serjooo](https://forums.swift.org/u/serjooo)\
**Replies:** 6\
**Last updated:** [March 3, 2021, 12:36pm UTC](https://forums.swift.org/t/set-uniqueness-of-instances-with-the-same-hashvalue/45235 "2021-03-03T12:36:57Z")

</div>

I stumbled on an unexpected behavior of Sets and Dictionaries while conforming to Hashable. I am wondering how are Sets and Dictionarys expected to behave for values with the same hashValue, but that aren't equatable? G…

---

## [Making an Enum Equatable when it has an associated type of Error](https://forums.swift.org/t/making-an-enum-equatable-when-it-has-an-associated-type-of-error/40850)

<div class="topic-metadata">

**Author:** [@tourultimate](https://forums.swift.org/u/tourultimate)\
**Replies:** 4\
**Last updated:** [October 9, 2020, 7:42pm UTC](https://forums.swift.org/t/making-an-enum-equatable-when-it-has-an-associated-type-of-error/40850 "2020-10-09T19:42:33Z")

</div>

We are developing a distributable package (framework) and have an enum that looks something like this: public enum Status: Equatable { case waiting case initialized case failed(Error) } We definitely want t…
