Error : Binary operator \'==\' cannot be applied to operands of type \'UILabel?\' and \'String\'
import UIKit class ViewController: UIViewController { let So
UIButton.titleLabel is a UILabel and it stores its text in UILabel.text property:
UILabel
let hardness = sender.titleLabel.text
In the case of UIButton you can also access UIButton.currentTitle property:
UIButton
let hardness = sender.currentTitle