let lb = UIButton()//LoginButton(readPermissions: [ .email, .publicProfile ])
lb.center = self.view.center
//Set constraints
NSLayoutConstraint.activate([
lb.centerXAnchor.constraint(equalTo: self.view.centerXAnchor), // centerXAnchor which set over the view center
lb.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: 70.0), // BottomAnchor to set with botton target
lb.widthAnchor.constraint(equalToConstant: 170.0), // Width Anchor to set appropriate width
lb.heightAnchor.constraint(equalToConstant: 44.0) // Height Anchor to set appropriate hegiht of the button.
])
self.view.addSubview(lb)
lb.delegate = self
You can even add that button from your UI interface(Storyboard OR XIB) if any problem with programmatically constraints.
Simply, Create an instance with @IBOutlet.
Assign FBSDKLoginButton class and set the delegate to that button.
@IBOutlet weak var loginButton: FBSDKLoginButton!
for more information please visit this link: Facebook Login button for Swift