Giter Site home page Giter Site logo

bottompopup's Introduction

BottomPopup

BottomPopup provides a popup-like presentation style to any view controller

What does BottomPopup do?

It is a custom presentation style for view controllers to present any view controller with slide animation from bottom of the screen.

What does it look like ?

Actually depends on your view controller, a real world examples can be seen below;

|

How is it set up?

Using CocoaPods (Recommended)

Add below line to your Podfile;

pod 'BottomPopup'

Then you can install it with pod install command.

Manual

Download the project, just drag and drop classes under BottomPopupController file to your project.

How is it used?

After install, simply make your view controller subclass of BottomPopupViewController.

For navigation controllers, it works exactly in same way, make your navigation controller subclass of BottomPopupNavigationController.

Congratulations, your view controller is ready to show ๐ŸŽ‰

Then you can present your controller with native presentViewController:animated:completion: method, bottom popup controller will handle rest.

Customization

Bottom popup comes with couple of customizable properties. Since your view controller subclass of BottomPopupViewController now, you can override following methods in your view controller to change behaviour;

  • shouldPopupDismissInteractivelty() -> Bool

    Determines your popup should dismiss whether interactively or not. If it is set to yes, user can dismiss popup with pulling down it down. Default is YES

  • getPopupHeight() -> CGFloat

    Height value. Default is 377 pt. For example you can return UIScreen.main.bounds.size.height to give it full screen height.

  • getPopupTopCornerRadius() -> CGFloat

    Corner radius of popup. Default is 10pt

  • getPopupPresentDuration() -> Double

    Present animation duration. Default is 0.5 sec

  • getPopupDismissDuration() -> Double

    Dismiss animation duration. Default is 0.5 sec

  • getDimmingViewAlpha() -> CGFloat

    Target alpha value of the black-colored dimming view after present animation. Default is 0.5

    You can see how changing of these properties changes popup's behaviour below. (Gifs are extracted from example project)

    UIViewController UINavigationController

Delegate

If you want to track popup lifecycle or current dismiss interaction percent, you can set popupDelegate;

popupVC.popupDelegate = self

Methods;

func bottomPopupViewLoaded()
func bottomPopupWillAppear()
func bottomPopupDidAppear()
func bottomPopupWillDismiss()
func bottomPopupDidDismiss()
func bottomPopupDismissInteractionPercentChanged(from oldValue: CGFloat, to newValue: CGFloat)

Questions or Advices

Just send me an email ([email protected])

bottompopup's People

Contributors

ergunemr avatar erjanmx avatar metinkilicaslan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.