2
我該如何解決這個問題?我是一個新的編碼器。謝謝錯誤:「不能分配給類型'Bool'的不可變表達式」?
我得到了如下錯誤:
"Cannot assign to immutable expression of type 'Bool'"
當我嘗試了「isSelected」設置爲false
和true
@IBAction func onFilter(_ sender: Any) {
if ((sender as AnyObject).isSelected == true) {
hideSecondaryMenu()
(sender as AnyObject).isSelected = false
} else {
showSecondaryMenu()
(sender as AnyObject).isSelected = true
}
}