alkhokhlov / Swiftypagecontroller
Licence: mit
SwiftyPageController will be helpful to use in many pages controller
Stars: ✭ 55
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Swiftypagecontroller
whatisnewdialog
An Android library for displaying a dialog where it presents new features in the app.
Stars: ✭ 22 (-60%)
Mutual labels: parallax, customizable
Lax.js
Simple & lightweight (<4kb gzipped) vanilla JavaScript library to create smooth & beautiful animations when you scroll.
Stars: ✭ 8,274 (+14943.64%)
Mutual labels: parallax
Jfminimalnotifications
An iOS UIView for presenting a minimalistic notification that doesn't block the UI and is highly configurable.
Stars: ✭ 957 (+1640%)
Mutual labels: customizable
Frontend Mentor Challenge
Here you will find all the challenges that we took from frontend-mentor.
Stars: ✭ 47 (-14.55%)
Mutual labels: page
Parallax background
jQuery parallax background plugin based on GSAP
Stars: ✭ 30 (-45.45%)
Mutual labels: parallax
Simpleparallax.js
Simple and tiny JavaScript library that adds parallax animations on any images
Stars: ✭ 1,075 (+1854.55%)
Mutual labels: parallax
Kiln Controller
Turns a Raspberry Pi into an inexpensive, web-enabled kiln controller.
Stars: ✭ 48 (-12.73%)
Mutual labels: controller
Hhcustomcorner
Awesome library to customize corners of UIView and UIButton. Now you can customize each corner differently
Stars: ✭ 36 (-34.55%)
Mutual labels: customizable
Autocrawler
Google, Naver multiprocess image web crawler (Selenium)
Stars: ✭ 957 (+1640%)
Mutual labels: customizable
Veluxi Starter
Veluxi Vue.js Starter Project with Nuxt JS and Vuetify
Stars: ✭ 39 (-29.09%)
Mutual labels: parallax
Laravel
Muito conteúdo sobre o framework Laravel. Controllers, Models, Views, Blade, Migrations, Seeders, Middlewares, Autenticação, Autorização, Providers, pacotes, laravel 8, etc.
Stars: ✭ 43 (-21.82%)
Mutual labels: controller
Gold Player
A first person player controller for Unity.
Stars: ✭ 53 (-3.64%)
Mutual labels: controller
SwiftyPageController
Description
SwiftyPageController will be helpful to use in many pages controller.
Advantages:
- customizable animation transition;
- customizable selecting buttons (you can implement them by your own)
How to use
- Add Contanier View from storyboard or programmatically
- Choose class for container controller SwiftyPageController
- Setup like example below
class ViewController: UIViewController {
@IBOutlet weak var segmentControl: UISegmentedControl!
var containerController: SwiftyPageController!
override func viewDidLoad() {
super.viewDidLoad()
segmentControl.addTarget(self, action: #selector(segmentControlDidChange(_:)), for: .valueChanged)
}
func segmentControlDidChange(_ sender: UISegmentedControl) {
// select needed controller
containerController.selectController(atIndex: sender.selectedSegmentIndex, animated: true)
}
func setupContainerController(_ controller: SwiftyPageController) {
// assign variable
containerController = controller
// set delegate
containerController.delegate = self
// set animation type
containerController.animator = .parallax
// set view controllers
let firstController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "\(FirstViewController.self)")
let secondController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "\(SecondViewController.self)")
let thirdController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "\(ThirdViewController.self)")
containerController.viewControllers = [firstController, secondController, thirdController]
// select needed controller
containerController.selectController(atIndex: 0, animated: false)
}
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let containerController = segue.destination as? SwiftyPageController {
setupContainerController(containerController)
}
}
}
- In ViewController where you added container controller implement SwiftyPageControllerDelegate
func swiftyPageController(_ controller: SwiftyPageController, alongSideTransitionToController toController: UIViewController) {
}
func swiftyPageController(_ controller: SwiftyPageController, didMoveToController toController: UIViewController) {
segmentControl.selectedSegmentIndex = containerController.viewControllers.index(of: toController)!
}
func swiftyPageController(_ controller: SwiftyPageController, willMoveToController toController: UIViewController) {
}
- For selecting needed tab use method
func selectController(atIndex index: Int, animated: Bool)
Animation
To choose animation use property
public var animator: AnimatorType
You can use three types of animation:
- default
- parallax
- custom
If you want to create own animation you need to implement SwiftyPageControllerAnimatorProtocol.
public protocol SwiftyPageControllerAnimatorProtocol {
var animationDuration: TimeInterval { get }
var animationProgress: Float { get set }
var animationSpeed: Float { get set }
func setupAnimation(fromController: UIViewController, toController: UIViewController, panGesture: UIPanGestureRecognizer, animationDirection: SwiftyPageController.AnimationDirection)
func didFinishAnimation(fromController: UIViewController, toController: UIViewController)
}
And use it like that:
containerController.animator = .custom(CustomAnimationController())
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
SwiftyPageController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SwiftyPageController"
Author
alkhokhlov, [email protected]
License
SwiftyPageController is available under the MIT license. See the LICENSE file for more info.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].