Hi Brian,
on using ternary operator :
isFormValid == true ? (self.registerButton.backgroundColor = #colorLiteral(red: 0.8078431487, green: 0.02745098062, blue: 0.3333333433, alpha: 1) , self.registerButton.setTitleColor(.white, for: .normal)) : (self.registerButton.backgroundColor = .lightGray,self.registerButton.setTitleColor(.gray, for: .normal))
i'm getting Expression of type '((), Void)' is unused, how can i silent this swift warning ?
this is the function in which i used ternary operator:
fileprivate func setupRegistrationViewModelObserver() {
registrationViewModel.isFormValidObserver = {[unowned self](isFormValid) in
print("Form is changing, is it valid?",isFormValid)
self.registerButton.isEnabled = isFormValid
isFormValid == true ? (self.registerButton.backgroundColor = .green , self.registerButton.setTitleColor(.white, for: .normal)) : (self.registerButton.backgroundColor = .lightGray,self.registerButton.setTitleColor(.gray, for: .normal))
}
}