bcylin / QuickTableViewController

A simple way to create a UITableView for settings in Swift.

Home Page:https://bcylin.github.io/QuickTableViewController

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to disable deselecting radio buttons?

alamodey opened this issue · comments

I want to be able to make the radio buttons act like compulsory radio buttons where there is something selected. So if someone presses a button that is already selected, I don't want to select that row. How do I do this?

I think it relates to this section but can't figure out how I should modify it:

  /// The state of selection.
  public var isSelected: Bool = false {
    didSet {
      guard isSelected != oldValue else {
        return
      }
      DispatchQueue.main.async {
        self.action?(self)
      }
    }
  }

There's a configuration in RadioSection that might be what you need.

let radioSection = RadioSection(...)
radioSection.alwaysSelectsOneOption = true
commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.