I've got a menu UIViewController I slide in from the left. (Client requirement). Targeting 13.1 in Xcode 11.1.
The issue I have is when I slide it in with my custom transition it hops down about 20 pixels. If I set the top of the presented ViewController down 20 pixels before sliding it in it doesn't do the hop. It looks like it's trying to fo the new card-like presentation.
Using the UIModalPresentationStyle.fullScreen doesn't stop the hop. I need the transparent background anyway so UIModalPresentationStyle.overFullScreen or UIModalPresentationStyle.overCurrentContext are required anyway.
I have a suspicion this is navigation bar related. The presenting UIViewControllers have navbars and the presented UIViewController does not.
Any help would be appreciated.
class SegueFromLeft: UIStoryboardSegue {
override func perform() {
let src = self.source
let dst = self.destination
// The offset is the starting y for the menu ViewController
var offset:CGFloat = 44.0 // good for iPhone 11
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
dst.view.transform = CGAffineTransform(translationX: -src.view.frame.size.width, y: offset)
UIView.animate(withDuration: 0.35,
delay: 0.0,
options: .curveEaseInOut,
animations: {
dst.view.transform = CGAffineTransform(translationX: 0, y: offset)
},
completion: { finished in
src.present(dst, animated: false, completion: nil)
}
)
}
}