Skip to content

Commit

Permalink
fix: make coatyuuid equatable
Browse files Browse the repository at this point in the history
  • Loading branch information
melloskitten committed Oct 29, 2019
1 parent ccd4aaf commit 3a2b1d7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions CoatySwift/Classes/Common/CoatyUUID.swift
Expand Up @@ -10,15 +10,15 @@ import Foundation
/// Custom implementation of a UUID that actually is compatible with the RFC
/// specification of sending UUIDs over the network (lowercase in contrast to Apple's
/// uppercase implementation).
public class CoatyUUID: Codable {
public class CoatyUUID: Codable, Equatable {

private var uuid: UUID

public var string: String {
return uuid.uuidString.lowercased()
}

public override init() {
public init() {
self.uuid = .init()
}

Expand All @@ -45,16 +45,13 @@ public class CoatyUUID: Codable {

// MARK: - Equatable methods.

public override func isEqual(_ object: Any?) -> Bool {
if let other = object as? CoatyUUID {
return self.uuid == other.uuid
}
return false
public static func == (lhs: CoatyUUID, rhs: CoatyUUID) -> Bool {
return lhs.uuid == rhs.uuid
}

// MARK: - String Convertible.

override public var description: String {
public var description: String {
return self.string
}
}

0 comments on commit 3a2b1d7

Please sign in to comment.