A universally unique value that can be used to identify types, interfaces, and other items.


struct UUID


Creating UUIDs


Initializes a new UUID with RFC 4122 version 4 random bytes.

init(uuid: uuid_t)

Create a UUID from a uuid_t.

Getting UUID Values

var uuid: uuid_t

Returns the UUID as bytes.

var uuidString: String

Returns a string created from the UUID, such as “E621E1F8-C36C-495A-93FC-0C247A3E6E5F”

Comparing UUIDs

static func != (UUID, UUID) -> Bool

Returns a Boolean value indicating whether two values are not equal.

static func == (UUID, UUID) -> Bool

Indicates whether two UUIDs are the same.

Describing UUIDs

var description: String

A textual description of the UUID.

var debugDescription: String

A textual description of the UUID suitable for debugging.

var customMirror: Mirror

A mirror that reflects the UUID.

var hashValue: Int

The computed hash value of the UUID.

Using Reference Types

class NSUUID

An object representing a universally unique value that bridges to UUID; use NSUUID when you need reference semantics or other Foundation-specific behavior.

typealias UUID.ReferenceType

An alias for this value type's equivalent reference type.