How to disable an ImageCheckRow

I’ve been struggling with this for a few days. I have a list of ImageCheckRow types and I want to mark them as checked or not checked and then disable them so the user can’t change them.
I have the following code executing:

                            let multi = subvalue.extractBool("multi", ifnil: false)
                            let disableEntry = subvalue.extractBool("disabled", ifnil: false)
                            let title: String! = subvalue.extractString("title", ifnil: "Select")
                            let defaultValues = subvalue.extractNSDictionary("values");

                            let imageChecked: String!
                            let imageUnchecked: String!

                            if (multi)! {
                                currentSection = SelectableSection<ImageCheckRow<String>>(title, selectionType: .multipleSelection)
                                imageChecked = "images/checkbox-checked"
                                imageUnchecked = "images/checkbox-unchecked"
                            } else {
                                currentSection = SelectableSection<ImageCheckRow<String>>(title, selectionType: .singleSelection(enableDeselection: true))

                                // We should change these to radios at some point
                                imageChecked = "images/radio-checked"
                                imageUnchecked = "images/radio-unchecked"
                            form +++ currentSection!

                            if let options = subvalue.extractArray("options") {
                                for option in options {
                                    for (optionKey, optionValue) in option as! NSDictionary {

                                        currentSection! <<< ImageCheckRow<String> { row in
                                            row.tag = "(tagname)_(optionKey)"
                                            row.title = optionValue as? String
                                            row.selectableValue = optionKey as? String

                                            if let dvkey = optionKey as? String {
                                                if let _ = defaultValues?.value(forKey: dvkey) {
                                                    row.value = optionKey as? String

                                            row.disabled = Condition(booleanLiteral: disableEntry!)

                                        }.cellSetup { cell, _ in
                                            cell.trueImage = UIImage(named: imageChecked)!
                                            cell.falseImage = UIImage(named: imageUnchecked)!

When ‘disableEntry’ is true the ImageCheckRow is still valid for clicking and the image changes from checked to unchecked and vice-versa. How should I be disabling these rows?

Miner Asked on June 13, 2017 in General Stack.
Add Comment


  • 1 Answer(s)
    Best answer

    Hi dude, i found solution, it was little bug, please see this post.


    In SelectableSection.swift,

    guard let s = self else { return }

    need to change  it like this

    guard let s = self, !row.isDisabled else { return }

    Then everything is done, i want to reply your answer then, registered this unknown forum, maybe clone of stackoverflow, but not familiar site, please use stackoverflow.


    Cheers!!! 🙂

    Default Answered on July 4, 2017.
    Add Comment

    Write your answer

    By posting your answer, you agree to the privacy policy and terms of service.