Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Master #153

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SwiftForms/controllers/FormOptionsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ 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
}

} else if let selectedOption = formCell?.rowDescriptor?.value {
if optionValue === selectedOption {
if optionValue.isEqual(selectedOption as Any) {
cell?.accessoryType = .checkmark
} else {
cell?.accessoryType = .none
Expand All @@ -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 {
Expand Down