HomeiOS Developmentios - It is not possible Curl Pages within the SwiftUI?

ios – It is not possible Curl Pages within the SwiftUI?


I am exploring learn how to implement web page curling in SwiftUI, just like what’s accessible in UIKit utilizing UIPageViewController with the .pageCurl transition type.

let PagesCurl = UIPageViewController(transitionStyle: .pageCurl, navigationOrientation: .horizontal, choices: nil)

In SwiftUI, I am seeking to obtain a web page curl impact the place customers can flip pages with their finger, prone to the type seen in Apple E-book Shops. Here is a simplified SwiftUI instance I have been engaged on:

struct Episode1View: View {
@State personal var currentPage = 0
let contentCount = 11 // Variety of content material slices

var physique: some View {
    TabView(choice: $currentPage) {
        ForEach(1...contentCount, id: .self) { index in
            BeforeThePage(imageName: "C1 Slice (index)")
        }
    }
    .navigationBarTitle("", displayMode: .inline)
    .navigationBarHidden(true)
    .rotation3DEffect(
        .levels(currentPage == 0 ? 0 : 180),
        axis: (x: 0, y: 1, z: 0),
        anchor: .trailing,
        perspective: 0.5
    )
    .animation(.default)
}

}

struct BeforeThePage: View {
let imageName: String

var physique: some View {
    Picture(imageName)
        .resizable()
        .aspectRatio(contentMode: .match)
        .body(maxWidth: .infinity, maxHeight: .infinity)
        .background(Shade.white)
}

}

When you’ve got any ideas or insights on attaining a sensible web page curling impact in SwiftUI, I might drastically recognize your enter. Thanks!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments