Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blsage/iPages
Quickly implement swipable page views.
https://github.com/blsage/iPages
Last synced: about 2 months ago
JSON representation
Quickly implement swipable page views.
- Host: GitHub
- URL: https://github.com/blsage/iPages
- Owner: blsage
- License: gpl-3.0
- Created: 2020-10-04T01:00:10.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-22T22:35:55.000Z (over 3 years ago)
- Last Synced: 2024-05-21T12:47:53.567Z (7 months ago)
- Language: Swift
- Homepage:
- Size: 7.4 MB
- Stars: 171
- Watchers: 5
- Forks: 16
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-swift - iPages - Quickly implement swipable page views in SwiftUI π. (Libs / UI)
- fucking-awesome-swift - iPages - Quickly implement swipable page views in SwiftUI π. (Libs / UI)
README
iPagesπ
Quickly implement swipable page views in iOS. π
Get Started |
Examples |
Customize |
Install |
## Get Started
1. [Install](https://github.com/benjaminsage/iPages/blob/main/INSTALL.md) `iPages`
2. Add `iPages` to your project
```swift
import SwiftUI
import iPagesstruct ContentView: View {
var body: some View {
iPages {
Text("iPages π€")
Color.pink
}
}
}
```3. Customize your `iPages`
## Examples
### Marketing Materials πΈUse `iGraphicsView` to demo marketing slides.
```swift
import SwiftUI
import iPages
import iGraphicsstruct ContentView: View {
var body: some View {
iPages {
iGraphicsView(.first)
iGraphicsView(.second)
iGraphicsView(.third)
}
}
}
```
Shopping App π
If you want, you can pass in your own optional selection binding to iPages. Hide the bottom dots & add infinite scroll to remove context.
```swift
import SwiftUI
import iPages
import iGraphicsstruct ContentView: View {
@State var currentPage: Int = 0var body: some View {
iPages(selection: $currentPage) {
iGraphicsBox(.photo)
.stack(3)
iGraphicsBox(.card)
.stack(2)
}
.hideDots(true)
.wraps(true)
}
}
```
## Customize π
`iPages` takes a trailing view builder of ordered views. You can also optionally pass in your own page index binding called `selection:`, to let you build your own page control, or however you want to use it. `iPages` supports a variety of custom modifiers. All customizations are built into our modifiers.
**Example**: Change the dot colors, enable infinite wrap & hide dots for single page views with the following code block:
```swift
iPages(selection: $currentPage) {
Text("π")
}
.dotsTintColors(currentPage: Color, otherPages: Color)
.wraps(true)
.dotsHideForSinglePage(true)
.navigationOrientation(.vertical)```
Use our exhaustive input list to customize your views.
| | Modifier or Initializer | Description
| --- | --- | ---
π·ββοΈ | `.init(content:)` | Initializes the page ππ view.
π·ββοΈ | `.init(selection:content:)` | Initializes the page ππ view with a selection binding.
βΊ | `.hideDots(_:)` | Modifies whether or not the page view should include the standard page control dots. (β’β’β’β’)
π | `.wraps(_:)` | Modifies whether or not the page view should restart at the beginning π when swiping past the end (and vise-versa)
1οΈβ£ | `.dotsHideForSinglePage(_:)` | Modifies whether the page dots are hidden when there is only one page. 1οΈβ£β€΅οΈ
π¨ | `.dotsTintColors(currentPage:otherPages:)` | Modifies tint colors π‘π’π΄π£ to be used for the page dots.
π | `.dotsBackgroundStyle(_:)` | Modifies the background style βͺοΈπ of the page dots.
π | `.dotsAllowContinuousInteraction(_:)` | Modifies the continuous interaction settings of the dots. π
βοΈ | `.dotsAlignment(_:)` | Modifies the **alignment of the page dots**. π π
βοΈ | `.navigationOrientation(_:)` | Modifies the navigation **orientation** of the page view. βοΈ βοΈ
π¦Ώ | `.disableBounce(_:)` | Disables the **bounce** settings of the page view. This is especially useful for scroll views.
βοΈ | `.interPageSpacing(_:)` | Modifies the spacing between the pages. βοΈ
π₯ | `.animated(_:)` | Modifies whether the the pages animate the slide if the `selection` binding changes. π₯## Install
Use the Swift package manager to install. Find instructions [here](https://github.com/benjaminsage/iPages/blob/main/INSTALL.md)π