> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Swift Not Identical To

The `!==` (not identical to) operator is a binary comparison operator used to determine if two reference type variables point to different instances in memory. It evaluates to `true` if the operands reference distinct memory addresses, regardless of whether their underlying stored properties hold equivalent values.

## Syntax

```swift theme={"dark"}
expression1 !== expression2
```

* **`expression1`, `expression2`**: Operands must be of a reference type (i.e., instances of a `class` or types constrained to `AnyObject`).
* **Return Type**: `Bool`.

## Technical Mechanics

In Swift, memory management and instance allocation differentiate between value types (`struct`, `enum`) and reference types (`class`). The `!==` operator operates strictly at the pointer level for reference types.

When the compiler evaluates `A !== B`, it compares the memory addresses of the heap allocations that `A` and `B` point to. It does not inspect the state or properties of the objects themselves.

```swift theme={"dark"}
class StateNode {
    var identifier: Int
    init(identifier: Int) { self.identifier = identifier }
}

let nodeX = StateNode(identifier: 256)
let nodeY = StateNode(identifier: 256)
let nodeZ = nodeX

// Evaluates to true: nodeX and nodeY are distinct heap allocations
let distinctMemory = (nodeX !== nodeY) 

// Evaluates to false: nodeX and nodeZ point to the exact same heap allocation
let sharedMemory = (nodeX !== nodeZ) 
```

## Constraints and Rules

1. **Reference Types Only**: Attempting to use `!==` on value types (like `Int`, `String`, or custom `struct` types) results in a compile-time error, as value types do not have stable, shared memory identities in the same way reference types do.
2. **Protocol Independence**: The `!==` operator does not rely on or invoke the `Equatable` protocol. It is a low-level pointer comparison built into the Swift standard library.

## Distinction from `!=`

It is critical to distinguish `!==` (identity inequality) from `!=` (value inequality):

* **`!=` (Not Equal To)**: Compares the *semantic value* or *state* of two instances. It requires the type to conform to the `Equatable` protocol and invokes the `==` function under the hood, negating the result.
* **`!==` (Not Identical To)**: Compares the *memory address* of two instances. It ignores semantic value entirely. Two objects can be equal in value (`A == B` is `true`) but not identical in memory (`A !== B` is `true`).

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Swift Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
