ahmed ahmed - 1 month ago 11
Swift Question

Swift String Error

I get a "Enum element checked cannot be referenced as an instance member error". Please help

}else if self.ByOwner.checkState = .Checked{

self.performSegue(withIdentifier: "ToProductOwnersNameViewController#2", sender: nil)


Error image

Answer

As @MartinR mentioned, == is a comparison operator and single = (equal to) is assignment operator so if in any conditional statement you should state the statement like

if(self.ByOwner.checkState == Checked)

{

//work to be done 

}