Swift Push ViewController from FlexLayout View

I basically followed the tutorial from FlexLayout on making a series of remote Views.

That part went extremely well… But I’d like to make the clicking on each of the individual views push a different ViewController. I’m using tap gestures to make each of the views clickable… but neither love nor money will get them to actually take me to a ViewController.

If I try to present them I get:

Warning: Attempt to present on whose view is not in the window hierarchy

And if I try to push them I get some sort of nil error:

A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs.

Here’s the code:

SocialView

import FlexLayout

protocol SocialViewDelegate {
    func didTapButton()
}

class SocialView: UIView {
    
    var delegate: SocialViewDelegate?
    
 
    
    @IBOutlet weak var view1: UIView!
    @IBOutlet weak var view2: UIView!

    fileprivate let rootFlexContainer = UIView()

    init() {
        super.init(frame: .zero)
        backgroundColor = .white

        let view1 = UIView()
        let view2 = UIView()
        
        
        let text1 = UILabel()
        text1.text = "Photos"
        view1.backgroundColor = .white
        view1.addSubview(text1)
        let tap = UITapGestureRecognizer(target: self, action: #selector(goEvt))
                //tap.delegate = self
                view1.addGestureRecognizer(tap)

    @objc func goEvt() {
        //let vc2 = UsersViewController()
        //vc2.modalPresentationStyle = .fullScreen
        //let vc93 = SocialViewController(coder: aDecoder)
        let vip = SocialViewController()
        let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
        let vc = storyBoard.instantiateViewController(withIdentifier: "evview") as! EventsViewController
       // vip.present(vc, animated: true)
        vip.didTapButton()
}
        
        
        
     //   self.collectionView.addSubview(vc)
    }
    
    @objc func buttonTapAction() {
            delegate?.didTapButton()
        }

SocialViewController

class SocialViewController: UIViewController, SocialViewDelegate {
    func didTapButton() {
        let topdawg = EventsViewController()
        let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
        let vc = storyBoard.instantiateViewController(withIdentifier: "evview") as! EventsViewController
        self.present(topdawg, animated: true)
       // navigationController?.pushViewController(topdawg, animated: true)
    }
    
    fileprivate var mainView: SocialView {
        return self.view as! SocialView
    }

For this part:

let tap = UITapGestureRecognizer(target: self, action: #selector(goEvt))

You could put “goEvt” or “didTapButton”… One would keep you on SocialView, the other would take you to SocialViewController. Doesn’t matter. You can also see that I’ve commented out a few things I’ve tried… It all leads to either the first or second error I posted above.

I can’t make it to “EventsViewController” (or any other) no matter what I do.

So any help would be appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật