Giter VIP home page Giter VIP logo

popitup's Introduction

PopItUp

Carthage compatible GitHub release Swift 4.0 License: MIT CocoaPods Compatible

PopItUp is a mini framework that add a new method to UIViewContollers to help you present controllers like popup and have the same visual effect has a system popup would have.

How does it work?

PopItUp use new modal presentation style introduced in iOS 8 to present the presented view controller on top of the presenting on.

By default the popup size is determined using autolayout which means that with the right constraints you don't have to worry about the popup size.

Screenshot

Exemple

Requirements

  • iOS 9.0+
  • Xcode 9.0+
  • Swift 4.0+

Installation

CocoaPods

if not installed yet install cocoaPods with the following command

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build PopItUp

To integrate PopItUp into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'PopItUp'
end

This will install the latest version of Popup

Apply your configuration with the following command:

$ pod install

Usage

Presenting a popup view controller

import PopItUp


presentPopup(TestPopupViewController(), animated: true, completion: nil)

Dismiss the popup

Because we use the standard iOS modal system all you have to do is call the dismiss(animated:completion:) method

dismiss(animated: true, completion: nil)

Customize the popup presentation

The presentPopup method contains multiple parameters to customize the final result:

  • backgroundStyle: the background to display behind the popup. can be either a color or a blur.
  • constraints: List of constraints that apply to the popup.
  • transitioning: Transition to apply when presenting the view.
  • autoDismiss: true if the popup can be dismiss by a tap outside is bounds, false otherwise
presentPopup(TestPopupViewController(),
             animated: true,
             backgroundStyle: .blur(.dark), // present the popup with a blur effect has background
             constraints: [.leading(20), .width(220)], // fix leading edge and the width
             transitioning: .slide(.left), // the popup come and goes from the left side of the screen
             autoDismiss: false, // when touching outside the popup bound it is not dismissed
             completion: nil)

popitup's People

Contributors

fritzgerald avatar

Stargazers

MohsinAli avatar

Watchers

James Cloos avatar MohsinAli 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.