Skip to content

View Controller Doesn't Appear #2

Description

@p3scobar

A view controller doesn't appear when the popup is presented with the following code - just a blur view. What am I missing here?

View Controller A:


func showPopup() {
let vc = ViewControllerB()
let popup = PopupDialog(viewController: vc)
vc.popup = popup
self.present(popup, animated: true, completion: nil)
}

View Controller B:

class ViewControllerB: UIViewController {
var popup: PopupDialog?
override func viewDidLoad() {
super.viewDidLoad()
setupView()
}
lazy var card: UIView = {
let view = UIView()
view.backgroundColor = .white
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
func setupView() {
view.addSubview(card)
card.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
card.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
card.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
card.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions