Page view controller with bounce effect

Overview

BouncyPageViewController

Version License Platform

Page view controller with bounce effect inspired by motion design by Stan Yakushevish.

Quickstart

Create a queue of UIViewControllers to display

let pagesQueue: [UIViewController]() = ... // your view controllers here

Create a BouncyPageViewController passing initial view controllers

let pageViewController = BouncyPageViewController(initialViewControllers: Array(pagesQueue[0...1]))

Assign closures for providing next/pevious view controllers

pageViewController.viewControllerAfterViewController = self.viewControllerAfterViewController
pageViewController.viewControllerBeforeViewController = self.viewControllerBeforeViewController

Vend the next ViewController from the queue

func viewControllerAfterViewController(prevVC: UIViewController) -> UIViewController? {
    if let idx = self.pagesQueue.index(of: prevVC), idx + 1 < self.pagesQueue.count {
        return self.pagesQueue[idx + 1]
    }
    return nil
}

Assign a didScroll callback closure

pageViewController.didScroll = self.pageViewControllerDidScroll

Update the UI using the offset and progress

func pageViewControllerDidScroll(pageViewController: BouncyPageViewController, offset: CGFloat, progress: CGFloat) {
    for vc in pageViewController.visibleControllers() {
        let vc = (vc as! ViewController)
        vc.progress = progress

    }
}

Configuration

How much pages overlap eachother, more inset - higher bounce

    public var pageContentInset: CGFloat = 30

How long the bounce animates when you release the page

    public var pageBounceAnimationDuration: TimeInterval = 1

How far you can scroll the last page until it snaps back (half of the page by default)

    public var overscrollBounceMultiplier: CGFloat = 0.5

Example

To run the example project, clone the repo

$ pod install

and run as usual.

Installation

Requirements

iOS 9+

Swift 3

Carthage

To use latest release add this to Cartfile:

git "https://github.com/BohdanOrlov/BouncyPageViewController"

Then run in terminal:

$ carthage update

CocoaPods

BouncyPageViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BouncyPageViewController"

Due to Swift 3, you have to add this to the end of Podfile:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end 

Author

Bohdan Orlov, [email protected]

License

BouncyPageViewController is available under the MIT license. See the LICENSE file for more info.

You might also like...
A framework that provides CurtainController. CurtainController is a container view controller that implements a content-curtain interface. You can find a similar implementation in applications like Apple Maps, Find My, Stocks, etc. Someone calls it
A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI.

A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI. Many of these helpers are useful even in a pure UIKit project.

iOS custom controller used in Jobandtalent app to present new view controllers as cards
iOS custom controller used in Jobandtalent app to present new view controllers as cards

CardStackController iOS custom controller used in the Jobandtalent app to present new view controllers as cards. This controller behaves very similar

ElongationPreview is an elegant UI push-pop style view controller
ElongationPreview is an elegant UI push-pop style view controller

ElongationPreview is an elegant UI push-pop style view controller

Provides an iOS view controller allowing a user to draw their signature with their finger in a realistic style.
Provides an iOS view controller allowing a user to draw their signature with their finger in a realistic style.

Swift version now available! Mimicking pen-on-paper signatures with a touch screen presents a difficult set of challenges. The rate touch events are e

AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter
AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter

We are pleased to offer you our new free lightweight plugin named AGCircularPicker. AGCircularPicker is helpful for creating a controller aimed to man

Highly customizable Action Sheet Controller with Assets Preview written in Swift
Highly customizable Action Sheet Controller with Assets Preview written in Swift

PPAssetsActionController Play with me ▶️ 🖐 If you want to play with me, just tap here and enjoy! 🎩 🕴 Show me 🎪 Try me 📲 The easiest way to try me

Reel Search is a Swift UI controller that allows you to choose options from a list
Reel Search is a Swift UI controller that allows you to choose options from a list

REEL SEARCH Reel Search is a Swift UI controller that allows you to choose options from a list We specialize in the designing and coding of custom UI

A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

SwiftUI Drawer A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize. Contents Add the Package Basic Usage Examples Credits

Owner
Bohdan Orlov
Bohdan Orlov
Meet Page View Controller for iOS by Cleveroad

While a standard page view allows you to navigate between pages by using simple gestures, our component goes further

Cleveroad 397 Aug 20, 2022
A controller that uses a UIStackView and view controller composition to display content in a list

StackViewController Overview StackViewController is a Swift framework that simplifies the process of building forms and other static content using UIS

Seed 867 Dec 27, 2022
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Jogendra 1.4k Jan 4, 2023
Iridescent Effect View (inspired by Apple Pay Cash) ✨

Shiny Shiny is an iOS library that generates an iridescent effect view matched to the gyroscope, similar to the Apple Pay Cash card in the Wallet app.

Lasha Efremidze 768 Dec 2, 2022
Flutter Apple Product Store App UI Home Page With Getx

Flutter Apple Product Store App UI Home Page With Getx A new Flutter UI Project on my Youtube Channel . About The Project Create a beautiful Flutter U

Muawia Saeed 11 Dec 23, 2022
A page control similar to that used in Instagram

ISPageControl ISPageControl has a page control similar to that used in the Instagram Contents Requirements Installation Usage Communication Credits Li

Interactive 291 Dec 5, 2022
EdvoraUI - The UI for the login page for Edvora made in SwiftUI

About This is the UI for the login page for Edvora made in SwiftUI. Screenshot L

Noman Ahmad 0 Jan 11, 2022
Apple TV Parallax effect in Swift.

MPParallaxView Apple TV Parallax effect in Swift. Rotate view using touch or accelerometer. Usage To run the example project, clone the repo, and run

Droids On Roids 1.7k Jan 4, 2023
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

Christoffer Winterkvist 246 Dec 28, 2022
A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag

HidesNavigationBarWhenPushed A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed

Danil Gontovnik 55 Oct 19, 2022