UITraitCollection doesn't have any information after custom segue

121 Views Asked by At

When I return to my home screen after a logout, it can't return any information about its traitCollection. I would like to get its size class and it is not possible.

enter image description here

When I run the screen without any segue it has all the information:

print(self.view.traitCollection)

<UITraitCollection: 0x14fe47dd0; _UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 2.000000, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1, _UITraitNameForceTouchCapability = 1>

But when the screen runs after a custom segue, this is what it display:

print(self.view.traitCollection)

<UITraitCollection: 0x14fe21cc0; >

It doesn't have any information about the view.

The code of the custom segue is the below:

override func perform() {

    self.sourceViewController.presentViewController(self.destinationViewController as UIViewController, animated: false, completion: nil)

}
0

There are 0 best solutions below