在 swift 中可以使用系統關鍵字來作為方法名稱,只需要給關鍵字加上單引號即可
private func setUI() -> Void{
let button = UIButton(type: .custom)
button.frame = self.view.bounds
button.setTitle("回去", for: .normal)
button.addTarget(self, action: #selector(`return`), for:.touchUpInside)
self.view.addSubview(button)
}
// 看這個方法的名字
@objc func `return`() -> Void{
print("低調")
}