Search code examples
cosmicmind

ow do I use the materialkit switch on and off in a case statement or in a if-else statement for a function?


How do I use the materialkit switch on and off in a case statement or in a if-else statement for a function? It seems that the UIcontrol and Material Kit has two different syntax.


Solution

  • For Material, it is like this.

    let materialSwitch = MaterialSwitch()
    
    if .On == materialSwitch.switchState {
        // Do something
    } else {
       // Do something else....
    }