Q:

Custom Tabbar Button without being a UITabBarController

I am building an e-commerce app and would like to create the attached image.
I am presenting this controller Modally therefore, it will not be inside a Tabbar.
Is there an easy way I can add the Tabbar and create the button without creating a TabBar like view for each iPhone?
Or would it be best to just embed it into another UITabBarController?  Seems overkill...
Many thanks.

A:

Declare Checkout button and views for toolbar & shadow.
lazy var customView: UIView = {
    let vw = UIView()
    vw.backgroundColor = UIColor(red: 249/255, green: 249/255, blue: 249/255, alpha: 1.0)
    vw.translatesAutoresizingMaskIntoConstraints = false
    return vw
}()

lazy var shadowView: UIView = {
    let vw = UIView()
    vw.backgroundColor = UIColor.gray
    vw.translatesAutoresizingMaskIntoConstraints = false
    return vw
}()

lazy var checkoutButton: UIButton = {
    let btn = UIButton(type: .system)
    btn.tintColor = .white
    btn.layer.cornerRadius = 5
    btn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 20)
    btn.setTitle("Checkout", for: .normal)
    btn.backgroundColor = UIColor(red: 39/255, green: 39/255, blue: 39/255, alpha: 1.0)
    btn.translatesAutoresizingMaskIntoConstraints = false
    return btn
}()

Add all in viewDidLoad. 
override func viewDidLoad() {
    super.viewDidLoad()

    view.addSubview(customView)

    [customView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), 
    //Size of UITabBar from safeArea, so its compatible for iPhone X and others 
    customView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -49),
    customView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
    customView.heightAnchor.constraint(equalToConstant: 83)].forEach{ $0.isActive = true }

    view.addSubview(shadowView)

    [shadowView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
     shadowView.bottomAnchor.constraint(equalTo: customView.topAnchor),
     shadowView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
     shadowView.heightAnchor.constraint(equalToConstant: 0.5)].forEach{ $0.isActive = true }

    customView.addSubview(checkoutButton)

    [checkoutButton.leadingAnchor.constraint(equalTo: customView.leadingAnchor, constant: 10),
     checkoutButton.topAnchor.constraint(equalTo: customView.topAnchor, constant: 4.5),
     checkoutButton.trailingAnchor.constraint(equalTo: customView.trailingAnchor, constant: -10),
     checkoutButton.heightAnchor.constraint(equalToConstant: 40)].forEach{ $0.isActive = true }

}

