Swift wrapper for custom ViewController presentations on iOS

Overview

Version Carthage compatible Swift 3.0 Platform License codebeat badge Made with Love by Icalia Labs

Presentr is a simple customizable wrapper for the Custom View Controller Presentation API introduced in iOS 8.

About

iOS let's you modally present any view controller, but if you want the presented view controller to not cover the whole screen or modify anything about its presentation or transition you have to use the Custom View Controller Presentation API's.

This can be cumbersome, specially if you do it multiple times in your app. Presentr simplifies all of this. You just have to configure your Presentr object depending on how you want you view controller to be presented, and the framework handles everything for you.

These are just examples of an Alert UI presented in multiple ways. But, with Presentr you can present any custom View Controller you create in any of the Presentation types, or create your own custom one!

What's New

1.9

  • Support for Xcode 10 / iOS 12 / Swift 4.2
  • Last version before big 2.0 update

1.3.1

  • New FlipHorizontal transition type (thanks to @falkobuttler)
  • New CoverFromCorner transition type (thanks to @freakdragon)
  • New customOrientation ModalSize (thanks to @freakdragon)
  • KeyboardTranslation now works for all Presentation Type's (thanks to @oxozle)
  • Other bug fixes & improvements

1.3

  • Swift 4 / Xcode 9 / iOS 11 Support
  • Bug fixes

1.2.0

  • You can add custom BackgroundView. (thanks to @clebta)
  • Add custom text color for AlertViewController
  • New PresentationType called .dynamic that allows dynamic sizing of ViewController using AutoLayout to calculate size.
  • You can set the context so the presentation is done properly on a child view controller and not the whole screen.
  • You can also set the behavior for a tap outside the context.
  • Simpler PresentrAnimation architecture. Simpler to modify existing transition animations or create your own.
  • Two new animations to replace system ones, CoverVertical & CrossDissolve.
  • All animations are now Presentr's, no more Apple animations. This allows greater control & less bugs.
  • Swipe to dismiss feature greatly improved.
  • Bug fixes and other small improvements.

1.1.0

  • You are now able to create your own custom transition animations. See how in readme. (thanks to @fpg1503 & @danlozano)
  • New animation available, coverVerticalWithSpring (thanks to @fpg1503)

See CHANGELOG.md for previous

Contributing

  1. Fork project
  2. Checkout Develop branch
  3. Create Feature branch off of the Develop branch
  4. Create awesome feature/enhancement/bug-fix
  5. Optionally create Issue to discuss feature
  6. Submit pull request from your Feature branch to Presentr’s Develop branch

Supported Swift Versions

Presentr Version Swift Version Min. iOS Version
<= 0.1.8 Swift 2.2 >= iOS 8.0
== 0.2.1 Swift 2.3 >= iOS 8.0
>= 1.0.0 Swift 3.0 >= iOS 9.0
>= 1.3 Swift 4.0 >= iOS 9.0
>= 1.9 Swift 4.0 & Swift 4.2 >= iOS 9.0

Installation

Cocoapods

use_frameworks!

pod 'Presentr'

Carthage

Add Presentr to you Cartfile

github "IcaliaLabs/Presentr"

Install using

carthage update --platform ios

Manually

  1. Download and drop /Presentr folder in your project.
  2. You're done!

Getting started

Create a Presentr object

It is important to hold on to the Presentr object as a property on the presenting/current View Controller since internally it will be used as a delegate for the custom presentation, so you must hold a strong reference to it.

Your Presentr can be as simple as this:

class ViewController: UIViewController {

  let presenter = Presentr(presentationType: .alert)

}

Or as complex as this:

class ViewController: UIViewController {

  let presenter: Presentr = {
        let width = ModalSize.full
        let height = ModalSize.fluid(percentage: 0.20)
        let center = ModalCenterPosition.customOrigin(origin: CGPoint(x: 0, y: 0))
        let customType = PresentationType.custom(width: width, height: height, center: center)

        let customPresenter = Presentr(presentationType: customType)
        customPresenter.transitionType = .coverVerticalFromTop
        customPresenter.dismissTransitionType = .crossDissolve
        customPresenter.roundCorners = false
        customPresenter.backgroundColor = .green
        customPresenter.backgroundOpacity = 0.5
        customPresenter.dismissOnSwipe = true
        customPresenter.dismissOnSwipeDirection = .top
        return customPresenter
    }()
	
}

Present the view controller.

Instantiate the View Controller you want to present and use the customPresentViewController method along with your Presentr object to do the custom presentation.

let controller = SomeViewController()
customPresentViewController(presenter, viewController: controller, animated: true, completion: nil)

This is a helper method provided for you as an extension on UIViewController. It handles setting the Presentr object as the delegate for the presentation & transition.

Remember to setup Auto Layout on the ViewController so it can be displayed well on any size.

The PresentationType (and all other properties) can be changed later on in order to reuse the Presentr object for other presentations.

presenter.presentationType = .popup

Main Types

Presentation Type

public enum PresentationType {

  case alert
  case popup
  case topHalf
  case bottomHalf
  case fullScreen
  case dynamic(center: ModalCenterPosition)
  case custom(width: ModalSize, height: ModalSize, center: ModalCenterPosition)
  
}

Alert & Popup

BottomHalf & TopHalf

Transition Type

public enum TransitionType {

  case coverVertical
  case crossDissolve
  case coverVerticalFromTop
  case coverHorizontalFromRight
  case coverHorizontalFromLeft
  case custom(PresentrAnimation)
  
}

Properties

Properties are optional, as they all have Default values.

The only required property for Presentr is the PresentationType. You initialize the object with one, but it can be changed later on.

presenter.presentationType = .popup

You can choose a TransitionType, which is the animation that will be used to present or dismiss the view controller.

presenter.transitionType = .coverVerticalFromTop
presenter.dismissTransitionType = .crossDissolve

You can change the background color & opacity for the background view that will be displayed below the presented view controller. You can also set a customBackgroundView that will be displayed on top of the built-in background view.

presenter.backgroundColor = UIColor.red
presenter.backgroundOpacity = 1.0
presenter.customBackgroundView = UIView()

You could also turn on the blur effect for the background, and change it's style. If you turn on the blur effect the background color and opacity will be ignored.

presenter.blurBackground = true
presenter.blurStyle = UIBlurEffectStyle.light

You can choose to disable rounded corners on the view controller that will be presented.

presenter.roundCorners = false

If set to true you can modify the cornerRadius.

presenter.cornerRadius = 10

Using the PresentrShadow struct can set a custom shadow on the presented view controller.

let shadow = PresentrShadow()
shadow.shadowColor = .black
shadow.shadowOpacity = 0.5
shadow.shadowOffset = CGSize(5,5)
shadow.shadowRadius = 4.0

presenter.dropShadow = shadow

You can choose to disable dismissOnTap that dismisses the presented view controller on tapping the background. Default is true. Or you can disable the animation for the dismissOnTap and dismissOnSwipe.

presenter.dismissOnTap = false
presenter.dismissAnimated = false

You can activate dismissOnSwipe so that swiping inside the presented view controller dismisses it. Default is false because if your view controller uses any kind of scroll view this is not recommended as it will mess with the scrolling.

You can also se the direction, for example in case your ViewController is an Alert at the top, you would want to dismiss it by swiping up.

presenter.dismissOnSwipe = true
presenter.dismissOnSwipeDirection = .top

If you have text fields inside your modal and the presentationType property is set to popup, you can use a KeyboardTranslationType to tell Presentr how to handle your modal when the keyboard shows up.

presenter.keyboardTranslationType = .none
presenter.keyboardTranslationType = .moveUp
presenter.keyboardTranslationType = .compress
presenter.keyboardTranslationType = .stickToTop

If you are doing a presentation inside a SplitViewController or any other type of container/child ViewController situation you can use these properties to handle it properly.

Set the viewControllerForContext to the ViewController you want Presentr to use for framing the presentation context. shouldIgnoreTapOutsideContext is set to false by default. This handles what happens when they click outside the context (on the other ViewController).

Be sure to set the viewControllerForContext property before presenting, not on initialization, this makes sure that Auto Layout has finished it's work and the frame for the ViewController is correct.

@IBAction func didSelectShowAlert(_ sender: Any) {
	presenter.viewControllerForContext = self
	presenter.shouldIgnoreTapOutsideContext = true
	customPresentViewController(presenter, viewController: alertController, animated: true, completion: nil)
}

Other / Advanced

Requirements

  • iOS 9.0+
  • Xcode 8.0+
  • Swift 3.0+

Documentation

Read the docs.

Author

Daniel Lozano

Main Contributors

Gabriel Peart

Logo design by Eduardo Higareda
Alert design by Noe Araujo

License

Presentr is released under the MIT license.
See LICENSE for details.

Comments
  • No fullscreen modal

    No fullscreen modal

    Let's say you have an iPad app witch is splitting the screen in two (like multitasking). In the current state of Presentr, if I present a viewController on the left side, I will be able to customise my origin and size, but the PresentrController frame will still use the screen frame instead of filling only the presentingViewController frame.

    The result expected would be the same as using presentedVC.modalPresentationStyle = .OverCurrentContext.

    I will take a look in the day if I have time, otherwise, I'm really interested in this feature 😄

    enhancement help wanted 
    opened by tbaranes 20
  • [Deprecated by #27] Observe keyboard presentation and dismissal

    [Deprecated by #27] Observe keyboard presentation and dismissal

    For use when presented controller is presented as a popup. Use case for when user has a text field and doesn’t want the keyboard to cover the bottom part of the presented view which would normally contain some kind of button.

    The view also won't dismiss on the tap of the container view when the keyboard is being shown. Instead, it will simply dismiss the keyboard. Added 'PresentrKeyboardDelegate' that has 'shouldDismissKeyboard' to which the presented view controller can conform to. This will notify that controller of the tap on the container so it can dismiss the keyboard

    Added 'KeyboardTranslationType' with '.MoveUp', '.Compress', '.None'. Move up will simply translate the view up on the y axis. Compress compresses the view between the keyboard and the status bar.

    opened by aasatt 17
  • Initializer for conditional binding must have Optional type, not 'CGFont'

    Initializer for conditional binding must have Optional type, not 'CGFont'

    static func loadFont(_ name: String) -> Bool { let bundle = Bundle(for: self) guard let fontPath = bundle.path(forResource: name, ofType: "ttf"), let data = try? Data(contentsOf: URL(fileURLWithPath: fontPath)), let provider = CGDataProvider(data: data as CFData), let font = CGFont(provider) else { return false }

        var error: Unmanaged<CFError>?
    
        let success = CTFontManagerRegisterGraphicsFont(font, &error)
        if !success {
            print("Error loading font. Font is possibly already registered.")
            return false
        }
    
        return true
    }
    

    in let font = CGFont(provider) error swift 4.0

    opened by salah-mohammed 16
  • Issue with modal popup and segued

    Issue with modal popup and segued

    I've been having an issue with modally Presented view controllers. It looks like if I segue over a Presented view controller with a width and height that is smaller than the view, it stretches out to the full width and height of the screen.

    discussion needed 
    opened by patthehuman 15
  • Version 1.2.1 appear to be broken

    Version 1.2.1 appear to be broken

    Hello,

    first thing: thank you for this very nice framework!!! Discovered yesterday and I'm already in love with that 💯

    I did some play with the sample project and everything was fine and smooth. I then decided to import the library with Carthage into my client app but this is what I got:

    *** Checking out Presentr at "1.2.1"
    *** xcodebuild output can be found in /var/folders/09/ytvs4f1x2fq2lcrnkvl46rq00000gn/T/carthage-xcodebuild.1CxKNf.log
    *** Building scheme "Presentr" in Presentr.xcodeproj
    Build Failed
    	Task failed with exit code 65:
    	/usr/bin/xcrun xcodebuild -project /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr.xcodeproj -scheme Presentr -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build
    
    This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/09/ytvs4f1x2fq2lcrnkvl46rq00000gn/T/carthage-xcodebuild.1CxKNf.log
    

    The diagnosis it's right and when I open the Carthage/Checkouts/Presentr project Xcode complains and cannot build. It seems to me the git repo it's in a broken state but tbh not sure what's happening.

    This is the content of the log file:

    /usr/bin/xcrun xcodebuild -project /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr.xcodeproj -scheme Presentr -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean buildBuild settings from command line:
        BITCODE_GENERATION_MODE = bitcode
        CARTHAGE = YES
        CODE_SIGN_IDENTITY = 
        CODE_SIGNING_REQUIRED = NO
        ONLY_ACTIVE_ARCH = NO
        SDKROOT = iphoneos10.2
    
    === CLEAN TARGET Presentr OF PROJECT Presentr WITH CONFIGURATION Release ===
    
    Check dependencies
    
    Create product structure
    /bin/mkdir -p /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework/Modules
    /bin/mkdir -p /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework/Headers
    
    Clean.Remove clean /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework
        builtin-rm -rf /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework
    
    Clean.Remove clean /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework.dSYM
        builtin-rm -rf /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework.dSYM
    
    Clean.Remove clean /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build
        builtin-rm -rf /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build
    
    ** CLEAN SUCCEEDED **
    
    === BUILD TARGET Presentr OF PROJECT Presentr WITH CONFIGURATION Release ===
    
    Check dependencies
    
    Write auxiliary files
    /bin/mkdir -p /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/armv7
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/armv7/Presentr-OutputFileMap.json
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/all-product-headers.yaml
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/swift-overrides.hmap
    /bin/mkdir -p /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/DerivedSources
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/DerivedSources/Presentr_vers.c
    /bin/mkdir -p /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/arm64
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/arm64/Presentr.LinkFileList
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr.hmap
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Script-06A15EA31DB5A73F005DD3DA.sh
    chmod 0755 /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Script-06A15EA31DB5A73F005DD3DA.sh
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/unextended-module-overlay.yaml
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/unextended-module.modulemap
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/arm64/Presentr-OutputFileMap.json
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-generated-files.hmap
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/armv7/Presentr.LinkFileList
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-own-target-headers.hmap
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-project-headers.hmap
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-all-non-framework-target-headers.hmap
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-all-target-headers.hmap
    write-file /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/module.modulemap
    
    Create product structure
    /bin/mkdir -p /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework/Modules
    /bin/mkdir -p /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/Presentr.framework/Headers
    
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
        cd /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr
        export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
        export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/UserName/.rvm/gems/ruby-2.3.0/bin:/Users/UserName/.rvm/gems/ruby-2.3.0@global/bin:/Users/UserName/.rvm/rubies/ruby-2.3.0/bin:/Users/UserName/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Users/UserName/.rvm/bin"
        export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk
        export TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name Presentr -O -whole-module-optimization -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -target arm64-apple-ios8.0 -g -module-cache-path /Users/UserName/Library/Developer/Xcode/DerivedData/ModuleCache -Xfrontend -serialize-debugging-options -embed-bitcode -I /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos -F /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos -c -num-threads 4 /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/CoverVerticalFromTopAnimation.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/CoverVerticalWithSpring.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/TransitionType.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/ModalCenterPosition.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/CoverHorizontalAnimation.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/KeyboardTranslation.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/Presentr.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/AlertViewController.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/PresentrController.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/ModalSize.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/Presentr+Equatable.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/PresentrAnimation.swift /Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/PresentationType.swift -output-file-map /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/arm64/Presentr-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/arm64/Presentr.swiftmodule -Xcc -I/Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-generated-files.hmap -Xcc -I/Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-own-target-headers.hmap -Xcc -I/Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Presentr-project-headers.hmap -Xcc -I/Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Products/Release-iphoneos/include -Xcc -I/Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/DerivedSources/arm64 -Xcc -I/Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/DerivedSources -emit-objc-header -emit-objc-header-path /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/Objects-normal/arm64/Presentr-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/UserName/Library/Developer/Xcode/DerivedData/Presentr-bkvtznitvmhqqxftqyrutlwxfxho/Build/Intermediates/Presentr.build/Release-iphoneos/Presentr.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr
    <unknown>:0: error: no such file or directory: '/Users/UserName/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/CoverVerticalWithSpring.swift'
    Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
    
    ** BUILD FAILED **
    
    
    The following build commands failed:
    	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
    (1 failure)
    
    

    FYI I cannot build from afc2baa07a, still:

    error: no such file or directory: '/Users/ofs/Development/TestPresentr/Carthage/Checkouts/Presentr/Presentr/CoverVerticalWithSpring.swift'
    

    but if I run pod install in the sample project I then get a valid development pod and I can play and get excited with that :)

    Any idea of what's happening? Thanks in advance and have a great day!

    bug help wanted 
    opened by marciomeschini 13
  • Add interaction controller for interactive transitions

    Add interaction controller for interactive transitions

    What does this PR do?

    • adds Interactr class which can easily be used with gesture recognizers to implement interactive transitions.

    Presentation

    let translation = sender.translation(in: view)
    let progress = interactr.calculateProgress(translation, viewBounds: view.bounds, direction: .right)
            
    interactr.mapGestureState(sender.state, progress: progress) {
        customPresentViewController(presentr, viewController: toViewController, animated: true, completion: nil)
    }
    

    Dismiss

    let translation = sender.translation(in: view)
    let progress = interactr.calculateProgress(translation, viewBounds: view.bounds, direction: .left)
            
    interactr.mapGestureState(sender.state, progress: progress) { [unowned self] in
        self.dismiss(animated: true, completion: nil)
    }
    
    opened by mrgrauel 10
  • When the PopupViewContreller dismissed,the UITableViewController which presented it,ran reloadData() didn't work

    When the PopupViewContreller dismissed,the UITableViewController which presented it,ran reloadData() didn't work

    Here's my PopupViewController and how I use it in my UITableViewController. popup

    popintbcontroller

    Usually,when DispatchQueue.main.async { self.tableView.reloadData() } worked,the method "cellForRowAtIndexPath" would ran as the nextstep. But when PopupViewController dismissed,the "reloadData()" ran but "cellForRowAtIndexPath" didn't react, so that the tableView cannot refresh immediately.

    under-investigation 
    opened by JackTheMico 10
  • Customise transition when dismissing

    Customise transition when dismissing

    For example: present the viewController with CoverHorizontalFromLeft then dismiss it using CoverHorizontalFromRight.

    It could be useful for more advanced use case :)

    enhancement 
    opened by tbaranes 10
  • Added swipe to dismiss gesture

    Added swipe to dismiss gesture

    Currently only working as a "pull to dismiss feature"

    Edited:

    • PresentrController.swift — Lines 22-30, 62-65, 74, 85, 109-111, 158-202
    • Presentr.swift — Lines 62-64, 170
    opened by josejuanqm 9
  • backgroundColor not showing, and transition type not as expected

    backgroundColor not showing, and transition type not as expected

    Hey, thanks for making this wonderful Presentr. :-)

    With 0.1.8 I want to modally display my view controller upon a view controller that is vended by an UINavigationController that is itself modally presented on top of another UINaviagationController backed stack. I present my view controller like this:

            let presenter: Presentr = {
                let width = ModalSize.Full
                let height = ModalSize.Custom(size: 393)
                let center = ModalCenterPosition.Center
                let customType = PresentationType.Custom(width: width, height: height, center: center)
    
                let customPresenter = Presentr(presentationType: customType)
                customPresenter.transitionType = .CoverHorizontalFromRight
                customPresenter.roundCorners = false
                customPresenter.backgroundColor = UIColor.redColor()
                customPresenter.backgroundOpacity = 0.7
                return customPresenter
            }()
    
            customPresentViewController(presenter, viewController: vc, animated: true, completion: nil)
    

    and it appears fine, but the backgroundColor is black with alpha 0 according to the view debugger. When I was running 0.1.6, with the default background color there, I had the same issue.

    From poking around a bit, it seems that private func presentationController(presented: UIViewController, presenting: UIViewController) -> PresentrControlleris never called. private func presentViewController(presentingViewController presentingVC: UIViewController, presentedViewController presentedVC: UIViewController, animated: Bool, completion: (() -> Void)?) is called just fine, but none of the if clauses succeed, so I get neither systemPresentTransition nor systemDismissTransition, which I expect is fine since I had it set to CoverHorizontalFromRight. Except that it does not cover from right either. When it comes up, it comes up from the bottom

    Do you have any hints or pointers to what's going on and how I should use Presentr differently to get it presented with a background color and the expected animation?

    Cheers

    Nik
    
    opened by niklassaers 9
  • Missing completion argument + dismiss animated flag

    Missing completion argument + dismiss animated flag

    Current master sync

    fix(completion): presentingViewController was been performed passing a nil competition, instead of the received argument fix(dismiss animated): PresentrController was using a hardcoded true value. Added a dismissAnimated flag feature(example): Added example of alert without animation and completion feature(swiftlint): adding swiftlint fix(swiftlint): fixing some swiftlint issues

    opened by gabrielPeart 9
  • Controller Moves up

    Controller Moves up

    Hi, I am trying to show Popup with TextView in it... When I open keyboard for TextView it jumps up the screen. I am using Compress presentation style... Corner radius also goes away... For searchbar it works fine... Here is my code for Controller presentation:

    let presenter: Presentr = {
                let width = UIDevice.current.iPad ? ModalSize.fluid(percentage: 0.70) : ModalSize.sideMargin(value: 16)
                let height = ModalSize.fluid(percentage: 0.80)
                let center = ModalCenterPosition.customOrigin(origin: CGPoint(x: UIDevice.current.iPad ? (UIScreen.main.bounds.width/2)/4 : 16, y: (UIScreen.main.bounds.height/2)/4))
                let customType = PresentationType.custom(width: width, height: height, center: center)
                
                let customPresenter = Presentr(presentationType: customType)
                customPresenter.roundCorners = true
                customPresenter.backgroundColor = .black
                customPresenter.backgroundOpacity = 0.5
                customPresenter.dismissOnSwipe = true
                customPresenter.keyboardTranslationType = .compress
                customPresenter.dismissOnSwipeDirection = .bottom
                return customPresenter
            }()
    

    Here is picture for issue :

    Simulator Screen Shot - iPhone 12 Pro Max - 2021-08-24 at 15 24 23

    opened by sohail-niazi 0
  • Add support for left + right on DismissSwipeDirection

    Add support for left + right on DismissSwipeDirection

    What does this PR do?

    • Add support for .left and .right to DismissSwipeDirection
    • Add dismissOnRelease dismiss presented view on gesture ended (like a traditional UIViewController)
    • Uses swipedAmount > 50% of VC rather than swipeLimit = 100
      • Also adds support for velocity-based dismissal, for when you quickly swipe the view away, but don't make it to the 50% limit
    • Add support for overdragResistanceFactor (see https://github.com/IcaliaLabs/Presentr/issues/163)
    opened by darnfish 1
  • `dismissTransitionType` set `.crossDissolve` no effect

    `dismissTransitionType` set `.crossDissolve` no effect

    Why I set'presenter.dismissTransitionType = TransitionType.crossDissolve' but no effect, always show the effect of ‘coverVertical’ And I added a breakpoint in Presentr.swift and found that the ‘animationController(forDismissed dismissed: UIViewController)’ function was not executed Using AlertViewController

    opened by bestannwn 2
  • [Touch] unexpected nil

    [Touch] unexpected nil

    I use your pod. But sometime a got the next situation. I show alert popup and can't dismiss it and console print log: [Touch] unexpected nil window in __sendSystemGestureLatentClientUpdate, _windowServerHitTestWindow: <UIWindow: 0x1063187b0; frame = (0 0; 375 812); autoresize = W+H; userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x281651dd0>; layer = <UIWindowLayer: 0x281ea7f80>>, touch:<UITouch: 0x10670fbf0> phase: Stationary tap count: 1 force: 1.133 window: (null) view: (null) location in window: {0, 0} previous location in window: {0, 0} location in view: {0, 0} previous location in view: {0, 0}

    And I have to relaunch my app. How can I fix it?

    opened by vkhadyka 1
  • Supported left & right directions for DismissSwipeDirection

    Supported left & right directions for DismissSwipeDirection

    Currently DismissSwipeDirection enum only vertical directions: top & bottom. There're some use cases where the view controller is presented from the left\right: presentr.transitionType = .coverHorizontalFromLeft. We should support horizontal gesture of DismissSwipeDirection as well.

    opened by duyquang91 0
Releases(1.2.0)
  • 1.2.0(Mar 24, 2017)

    1.2.0

    • You can add custom BackgroundView. (thanks to @clebta)
    • Add custom text color for AlertViewController
    • New PresentationType called .dynamic that allows dynamic sizing of ViewController using AutoLayout to calculate size.
    • You can set the context so the presentation is done properly on a child view controller and not the whole screen.
    • You can also set the behavior for a tap outside the context.
    • Simpler PresentrAnimation architecture. Simpler to modify existing transition animations or create your own.
    • Two new animations to replace system ones, CoverVertical & CrossDissolve.
    • All animations are now Presentr's, no more Apple animations. This allows greater control & less bugs.
    • Swipe to dismiss feature greatly improved.
    • Bug fixes and other small improvements.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Dec 27, 2016)

    1.1.0

    • You are now able to create your own custom transition animations. See how in readme. (thanks to @fpg1503 & @danlozano)
    • New animation available, coverVerticalWithSpring (thanks to @fpg1503)
    Source code(tar.gz)
    Source code(zip)
  • 1.0.5(Dec 22, 2016)

  • 1.0.4(Dec 22, 2016)

  • 1.0.3(Nov 2, 2016)

    Support for custom radius & drop shadow (thanks @falkobuttler) New fluid percentage option for ModalSize enum (thanks @mseijas) Example project and other general improvements (thanks @gabrielPeart)

    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Nov 2, 2016)

  • 1.0.1(Nov 2, 2016)

  • 1.0.0(Sep 28, 2016)

  • 0.2.0(Sep 28, 2016)

  • 0.1.8(Jul 26, 2016)

  • 0.1.7(Jul 26, 2016)

  • 0.1.6(Jul 26, 2016)

Owner
Icalia Labs
Development and design firm helping companies accelerate their digital transformation through agile software processes, practices and products
Icalia Labs
Simple way to present custom views as a popup in iOS and tvOS.

PopupKit PopupKit is a simple and flexible iOS framework for presenting any custom view as a popup. It includes a variety of options for controlling h

Pointwelve 59 Mar 1, 2022
A Swift Popup Module help you popup your custom view easily

JFPopup JFPopup is a Swift Module help you popup your custom view easily. Support 3 way to popup, Drawer, Dialog and BottomSheet. Example To run the e

逸风 77 Dec 14, 2022
IAMPopup is a simple class for expressing custom popup in various forms.

IAMPopup Introduction IAMPopup is a simple class for expressing custom popup in various forms. This includes where to display the popup and space to d

Hosung Kang 18 Dec 29, 2022
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.

SwiftEntryKit ?? Donations can be made here. Table of Contents Overview Features Example Project Example Project Installation Presets Playground Requi

Daniel Huri 6.1k Jan 6, 2023
Simple Swift class for iOS that shows nice popup windows with animation.

NMPopUpView Simple class for iOS that shows nice popup windows, written in Swift. The project is build with Swift 4.0, so you need Xcode 9.0 or higher

Nikos Maounis 194 Jun 5, 2022
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Orderella Ltd. 3.8k Dec 20, 2022
STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad. It's written in Objective-C and compatible with Swift.

STPopup STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad. It's written in Obj

Kevin Lin 2.6k Jan 6, 2023
PopupWindow is a simple Popup using another UIWindow in Swift

PopupWindow PopupWindow is a simple Popup using another UIWindow Feature PopupWindow can be displayed at the top or bottom of the screen. Popup can se

shinji hayashi 415 Dec 5, 2022
Popover is a balloon library like Facebook app. It is written in pure swift.

Popover Description and appetize.io`s DEMO Usage To run the example project, clone the repo, and run pod install from the Example directory first. Sim

Yusuke Takahashi 2k Jan 2, 2023
🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API.

Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexibl

Sebastian Boldt 2.4k Dec 25, 2022
🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API.

Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexibl

Sebastian Boldt 2.4k Dec 25, 2022
Present a sheet ViewController easily and control ViewController height with pangesture

PanControllerHeight is designed to present a sheet ViewController easily and control ViewController height with pangesture.

null 2 May 3, 2022
Provides a custom presentation modifier that provides more options including full screen presentations. (iOS)

Presentation Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+ Provides a custom presentation modifier that provides more

SwiftUI+ 15 Dec 3, 2022
DeckRocket turns your iPhone into a remote for Deckset presentations

DeckRocket DeckRocket turns your iPhone into a remote for Deckset presentations Requirements DeckRocket is built in Swift and relies on Multipeer Conn

JP Simard 398 Nov 22, 2022
ExpoMod - a small application tool that lets you quickly setting up your computer for presentations / exhibitions

ExpoMod is a small application tool that lets you quickly setting up your computer for presentations / exhibitions. Or simply having useful shortcut to not being distract and keep awake your computer.

Niemes 10 Jun 29, 2022
Custom Time Picker ViewController with Selection of start and end times in Swift 🔶

LFTimePicker Custom Time Picker ViewController with Selection of start and end times in Swift ?? . Based on Adey Salyard's design @ Dribbble One to tw

Awesome Labs 65 Nov 11, 2022
Easy interactive interruptible custom ViewController transitions

Introduction Transition is a library that helps you build iOS view controller transitions. Implementing a nice interactive custom view controller tran

Touchwonders 2.6k Dec 20, 2022
Reusable iOS's behavior drag or swipe to pop ViewController

DLSwipeToPopController Reusable iOS's behavior to pop ViewController base on SwipeRightToPopController: Swipe from Right to Left to pop ViewController

Le Ngoc Duy 1 Sep 17, 2022
Switch viewcontroller like ios task manager

Kaeru Kaeru can switch ViewController in NavigationController like iOS task manager UI (after iOS 9). Movie Usage You can use HistoryNavigationControl

bannzai 508 Dec 7, 2022
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.

PullToDismiss PullToDismiss provides dismiss modal viewcontroller function like Facebook Messenger by pulling scrollview or navigationbar with smooth

Suguru Kishimoto 479 Dec 5, 2022