Search code examples
swiftxcodeuipageviewcontroller

How do I get UIPageViewController to use Transition Style Scroll?


There are many questions on this topic and most of the answers are dated, so I am going to post this question.

Running Xcode 10.2.1 with Swift 5.1.

I have a UIPageViewController and I have set the Transition Style to Scroll in the Attributes Inspector.

enter image description here

However when I run the app in the simulator, Page Curl happens.

enter image description here

Is there a programmatic approach to make sure that the transition style is scroll?


Solution

  • Just add init code and initialize transition style programmatically.

    required init?(coder aDecoder: NSCoder) {
        super.init(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
    }
    

    enter image description here