I am new to Xcode and swift but I have been able to narrow the error source down to this line of code. I have searched every where but could not find the solution. I'm currently using Xcode 8.1.
button.addTarget( self, action: #selector(handleRegister), for:.touchUpInside)
this is some of my code
import UIKit
class LoginController: UIViewController {
let backGroundImageView: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "backgrd_image")
return imageView
}()
let inputsContainerView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.white
view.translatesAutoresizingMaskIntoConstraints = false
view.layer.cornerRadius = 5
view.layer.masksToBounds = true
return view
}()
let loginRegisterButton: UIButton = {
let button = UIButton(type: .system)
button.backgroundColor = UIColor(r: 80, g: 101, b: 161)
button.setTitle("Register", for: .normal)
button.setTitleColor(UIColor.white, for: .normal)
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
button.translatesAutoresizingMaskIntoConstraints = false
button.addTarget( self, action: #selector(handleRegister), for:.touchUpInside)
return button
}()
// when register button is clicked, printout 123
func handleRegister() {
print(123)
}
does anyone know what could be causing this Segmentation fault: 11 error.