# UUID - zero value

**URL:** <https://forums.swift.org/t/uuid-zero-value/85798>\
**Category:** Using Swift\
**Created:** [April 3, 2026, 4:14am UTC](https://forums.swift.org/t/uuid-zero-value/85798 "2026-04-03T04:14:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![somu](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@somu](https://forums.swift.org/u/somu)\
**Post date:** [April 3, 2026, 4:14am UTC](https://forums.swift.org/t/uuid-zero-value/85798/1 "2026-04-03T04:14:26Z")

</div>

Hi,

### Overview

- I am using UUID to generate unique values for an id field.
- However I have a scenario in which I need to check if it matches a special value to do something special.
- I can't have the id field as an optional, the real use case is in AppIntents.

### Question

1. What is the way to define a special UUID that I can be sure `UUID()` will not generate?
2. Can I use `UUID(uuid: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))`?
3. Or is there a better way to handle such a scenario?

# Code:

```swift
struct Car {
    let id: UUID
    let name: String
    
    static let demo = Car(id: .zero, name: "Demo Car")
}

extension UUID {
    static let zero = UUID(uuid: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
}

let c1 = Car(id: UUID(), name: "Car 1")
let c2 = Car(id: UUID(), name: "Car 2")

let demoCar = Car.demo

print(c1)
print(c2)
print(demoCar)

```

---

<div class="post-metadata">

**Author:** ![eskimo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/eskimo/32/13558_2.png) [@eskimo](https://forums.swift.org/u/eskimo)\
**Post date:** [April 3, 2026, 8:20am UTC](https://forums.swift.org/t/uuid-zero-value/85798/2 "2026-04-03T08:20:22Z")

</div>

That should be find. Check out the discussion of nil and max UUIDs in [RFC 9562](https://tools.ietf.org/html/rfc9562)

Oh, and there’s a fascinating discussion about this stuff currently going on over in [Related Products \> Foundation](https://forums.swift.org/t/pitch-uuid-v7-other-improvements/85427).

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

---

<div class="post-metadata">

**Author:** ![somu](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@somu](https://forums.swift.org/u/somu)\
**Post date:** [April 3, 2026, 8:33am UTC](https://forums.swift.org/t/uuid-zero-value/85798/3 "2026-04-03T08:33:05Z")

</div>

Thank you so much @eskimo Quinn!!

Really happy about the proposal @Tony_Parker, the sentinel values would be great!! Thanks!!

---

<div class="post-metadata">

**Author:** ![x-sheep](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/x-sheep/32/40748_2.png) [@x-sheep](https://forums.swift.org/u/x-sheep)\
**Post date:** [April 3, 2026, 12:08pm UTC](https://forums.swift.org/t/uuid-zero-value/85798/4 "2026-04-03T12:08:10Z")

</div>

`UUID(uuid: UUID_NULL)` also works, when using Apple platforms.

---

<div class="post-metadata">

**Author:** ![somu](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@somu](https://forums.swift.org/u/somu)\
**Post date:** [April 3, 2026, 1:43pm UTC](https://forums.swift.org/t/uuid-zero-value/85798/5 "2026-04-03T13:43:54Z")

</div>

Thanks a lot @x-sheep for that tip!

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [April 3, 2026, 2:24pm UTC](https://forums.swift.org/t/uuid-zero-value/85798/6 "2026-04-03T14:24:33Z")

</div>

You can also take the [`init` from `swift-dependencies`](https://github.com/pointfreeco/swift-dependencies/blob/44a2b25cd4ab8a130ad27963e6a5263cf11d2793/Sources/Dependencies/DependencyValues/UUID.swift#L132), which allows you to call it like `UUID(0)`. Library is a pretty good dependency solution too.
