From 6e21fba46960fba49a032e36eaa7228d2d32f291 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 15 Nov 2015 11:43:05 -0500 Subject: [PATCH] refactor --- SocketIOClientSwift/SocketIOClientOption.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/SocketIOClientSwift/SocketIOClientOption.swift b/SocketIOClientSwift/SocketIOClientOption.swift index 154c381..473f22a 100644 --- a/SocketIOClientSwift/SocketIOClientOption.swift +++ b/SocketIOClientSwift/SocketIOClientOption.swift @@ -108,15 +108,9 @@ public func ==(lhs: SocketIOClientOption, rhs: SocketIOClientOption) -> Bool { extension Set where Element: ClientOption { mutating func insertIgnore(element: Element) { - let (insertType, _) = Mirror(reflecting: element).children.first! - for item in self { - let (name, _) = Mirror(reflecting: item).children.first! - if insertType == name { - return - } + if !contains({$0.description == element.description}) { + insert(element) } - - self.insert(element) } static func NSDictionaryToSocketOptionsSet(dict: NSDictionary) -> Set {