Skip to content

Commit

Permalink
made UUID conform to CustomStringConvertible
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Apr 3, 2016
1 parent dc2e7a3 commit a371f80
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Sources/UUID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ public func == (lhs: Bluetooth.UUID, rhs: Bluetooth.UUID) -> Bool {
}
}

// MARK: - CustomStringConvertible

extension UUID: CustomStringConvertible {

public var description: String {

switch self {

case let .Bit16(value):

let bytes = value.littleEndianBytes

return bytes.0.toHexadecimal() + bytes.1.toHexadecimal()

case let .Bit128(value):

return value.description
}
}
}

// MARK: - Hashable

extension Bluetooth.UUID: Hashable {
Expand Down

0 comments on commit a371f80

Please sign in to comment.