0

I have several views implemented programatically in the app without using storyboard.

let customView = UIView()
    actionSheetHomeCall.view.addSubview(customView)
    customView.translatesAutoresizingMaskIntoConstraints = false
    customView.topAnchor.constraint(equalTo: actionSheetHomeCall.view.topAnchor, constant: 0).isActive = true
    customView.rightAnchor.constraint(equalTo: actionSheetHomeCall.view.rightAnchor, constant: -10).isActive = true
    customView.leftAnchor.constraint(equalTo: actionSheetHomeCall.view.leftAnchor, constant: 10).isActive = true
    customView.heightAnchor.constraint(equalToConstant: 175).isActive = true

When running the app in Xcode 13, app crashes by giving the errorNSInternalInconsistencyException', reason: 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES.'

if I remove translatesAutoresizingMaskIntoConstraints = false from the code, the ui is messy. Is there any solution for this?

Lak
  • 381
  • 1
  • 5
  • 23
  • have you checked any of [these](https://stackoverflow.com/search?tab=votes&q=Must%20translate%20autoresizing%20mask%20into%20constraints%20to%20have%20_setHostsLayoutEngine%3aYES)? – Phil Dukhov Mar 24 '22 at 10:33
  • What is `actionSheetHomeCall`? – DonMag Apr 01 '22 at 12:52

0 Answers0