Giter VIP home page Giter VIP logo

bottomsheetpresentation's Introduction

BottomSheetPresentation

A UIPresentationController and attendant clases for iOS to present a view controller pinned to the bottom of the screen like an action sheet.

Version Documentation Carthage compatible License Platform

Installation

CocoaPods

To use BottomSheetPresentation with CocoaPods, add a dependency to your Podfile:

target 'MyAwesomeApp' do
  pod 'BottomSheetPresentation'
end

Then run pod install and use the generated .xcworkspace to open your project.

Carthage

To use BottomSheetPresentation with Carthage, add a dependency to your Cartfile:

github "Detroit-Labs/BottomSheetPresentation"

Run carthage update to build the framework. Then follow the rest of the steps in Carthage’s README to add the framework to your project, configure a Run Script build phase, etc.

Manually

To integrate BottomSheetPresentation manually into your project, drag BottomSheetPresentation.swift into your Xcode project.

Using BottomSheetPresentation

Swift

To use BottomSheetPresentation, create a BottomSheetPresentationManager and set it as the transitioningDelegate of the view controller you want to present, then set the modalPresentationStyle of the view controller to .custom.

let manager = BottomSheetPresentationManager() // Save this reference somewhere
let viewControllerToPresent = 
viewControllerToPresent.transitioningDelegate = manager
viewControllerToPresent.modalPresentationStyle = .custom

present(viewControllerToPresent, animated: true, completion: nil)

Objective-C

BottomSheetPresentation also works with Objective-C:

BottomSheetPresentationManager *manager = [[BottomSheetPresentationManager alloc] init];

UIViewController *viewControllerToPresent = …;
viewControllerToPresent.transitioningDelegate = manager;
viewControllerToPresent.modalPresentationStyle = UIModalPresentationCustom;

[self presentViewController:viewControllerToPresent
                   animated:YES
                 completion:NULL];

Requirements

To correctly compute the height of the presented view controller, it must either satisfy Auto Layout constraints for a height using systemLayoutSizeFitting(UIView.layoutFittingCompressedSize) or have a non-zero preferredContentSize.

bottomsheetpresentation's People

Contributors

slaunchaman avatar

Watchers

 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.