From 4e9f66eeff4035dd61081e8a3a8ea66a65f45076 Mon Sep 17 00:00:00 2001 From: Kyle Emmanuel Date: Fri, 10 Mar 2017 13:22:18 +0800 Subject: [PATCH 1/2] Fixed multiple selector comparison issue --- SwiftForms/controllers/FormOptionsViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SwiftForms/controllers/FormOptionsViewController.swift b/SwiftForms/controllers/FormOptionsViewController.swift index 1146359..841fbaf 100644 --- a/SwiftForms/controllers/FormOptionsViewController.swift +++ b/SwiftForms/controllers/FormOptionsViewController.swift @@ -63,7 +63,7 @@ open class FormOptionsSelectorController: UITableViewController, FormSelector { cell?.textLabel?.text = formCell?.rowDescriptor?.configuration.selection.optionTitleClosure?(optionValue) if let selectedOptions = formCell?.rowDescriptor?.value as? [AnyObject] { - if let _ = selectedOptions.index(where: { $0 === optionValue }) { + if let _ = selectedOptions.index(where: { $0.isEqual(optionValue as Any) }) { cell?.accessoryType = .checkmark } else { cell?.accessoryType = .none @@ -96,7 +96,7 @@ open class FormOptionsSelectorController: UITableViewController, FormSelector { if allowsMultipleSelection { if var selectedOptions = formCell?.rowDescriptor?.value as? [AnyObject] { - if let index = selectedOptions.index(where: { $0 === selectedOption }) { + if let index = selectedOptions.index(where: { $0.isEqual(selectedOption as Any) }) { selectedOptions.remove(at: index) cell?.accessoryType = .none } else { From 8e57aa9bdb931461539013ae060ec92252675291 Mon Sep 17 00:00:00 2001 From: Kyle Emmanuel Date: Fri, 10 Mar 2017 14:23:42 +0800 Subject: [PATCH 2/2] Fixing single value selection --- SwiftForms/controllers/FormOptionsViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SwiftForms/controllers/FormOptionsViewController.swift b/SwiftForms/controllers/FormOptionsViewController.swift index 841fbaf..e90d134 100644 --- a/SwiftForms/controllers/FormOptionsViewController.swift +++ b/SwiftForms/controllers/FormOptionsViewController.swift @@ -70,7 +70,7 @@ open class FormOptionsSelectorController: UITableViewController, FormSelector { } } else if let selectedOption = formCell?.rowDescriptor?.value { - if optionValue === selectedOption { + if optionValue.isEqual(selectedOption as Any) { cell?.accessoryType = .checkmark } else { cell?.accessoryType = .none