Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
无论如何,我可以更改MaterialSwitch为返回真/假而不是开/关?
MaterialSwitch
print(switch.switchState) // prints true
你可以跑print(not switch.switchState)
print(not switch.switchState)
什么也没听到,我即兴创作并创建了一个新bool变量。然后我只是使用if语句通过访问hashValue.
bool
if
hashValue
if self.option1.switchState.hashValue == 1 { option1Value = false } else { option1Value = true }