From a371f800885a1a7d0b42c89225313e17402fc832 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Sat, 2 Apr 2016 21:27:49 -0500 Subject: [PATCH] made UUID conform to CustomStringConvertible --- Sources/UUID.swift | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Sources/UUID.swift b/Sources/UUID.swift index 316da5371..1abee1d75 100644 --- a/Sources/UUID.swift +++ b/Sources/UUID.swift @@ -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 {