Classes
The following classes are available globally.
-
This class provides a simple Swift-only module that implements a “checkbox” to replace the standard UISwitch. The switch can behave exactly like a standard UISwitch, but also has a “three-state” option, where it has definitely off, definitely on, and clear, which is a sort of “undefined” state. Default is two-state (like UISwitch). The class can use the SFSymbols checkbox symbols, but these are a bit awkward for UIKit (which is why UIKit doesn’t use them), so we have three dynamically-generated “artisanal” images that can be used to implement a round checkbox, which is friendlier for fat fingers. You can also supply three images to use for the control (or only two, if you are sticking with the “two-state” version). All images are drawn template mode, using the control
See moretintColor
. Like the UISwitch class, you can specifically callsetOn(_:animated:)
, and it will animate the transition. You can also callsetClear(animated:)
, if in three-state mode. This uses haptics, in the same manner as UISwitch, except that you can turn them off, by settinguseHaptics
to false.Declaration
Swift
@IBDesignable @MainActor open class RVS_Checkbox : UISwitch