Skip to content

timdubbins/PageView

Repository files navigation

PageView

Current version: 1.0.0 [Download]

A simple PageView implementation for SwiftUI. A benefit to using this implementation is that it works with ignoresSafeArea(:), whereas the PageTabViewStyle() modifier for TabView currently does not.

Getting Started

To use PageView in a project, in Xcode go to

File > Add Packages...

and enter

https://github.com/timdubbins/pageview

as the package URL.

Finally add an import PageView statement at the top of your view file.

Usage

var body: some View {
    PageView {
        pageOne
        pageTwo
        Text("Last page")
    }
    .ignoresSafeArea()
}

var pageOne: some View {
    ZStack {
        Color.red
        Text("Page 1")
    }
}

var pageTwo: some View {
    ZStack {
        Color.green
        Text("Page 2")
    }
}