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 (likeUISwitch
).By default, the class uses the SFSymbols checkbox symbols, but these are sometimes considered a bit awkward for UIKit (which is why UIKit doesn’t use them).
You can also supply three of your own images to use for the control (or only two, if you are sticking with the “two-state” version).
Images that specify
.alwaysTemplate
are drawn using the controltintColor
.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
See moreUISwitch
, except that you can turn them off, by settinguseHaptics
to false.Declaration
Swift
@IBDesignable @MainActor open class RVS_Checkbox : UISwitch