GithubHelp home page GithubHelp logo

icalialabs / presentr Goto Github PK

View Code? Open in Web Editor NEW
3.1K 44.0 270.0 1.58 MB

Swift wrapper for custom ViewController presentations on iOS

License: MIT License

Ruby 1.11% Swift 98.37% Objective-C 0.51%
ios presentation transition animation modal alert

presentr's Introduction

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

use_frameworks!

pod 'Presentr'

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.

presentr's People

Contributors

aasatt avatar alediaz84 avatar balestrapatrick avatar benaneesh avatar chlebta avatar danlozano avatar falkobuttler avatar fpg1503 avatar freakdragon avatar gabrielpeart avatar hcanzonetta avatar josejuanqm avatar jyounus avatar kurenn avatar lfarah avatar mamnun avatar mseijas avatar oxozle avatar readmecritic avatar tbaranes avatar voluntadpear avatar wacumov avatar xiao99xiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

presentr's Issues

Question: More than two buttons

Hello. Using origin Apple alert controller I can add more that 2 buttons and handle all of them. How can I do exactly the same using Presentr? As I can see, there is possible to use only 2 AlertActions. So, I think that it is possible to create new ViewControllers with buttons. But how should I handle them in my main ViewController? Thank you.

Swift 3

Hey, I'd love to contribute to Presentr and port it to Swift 3, but first you guys have to create a swift3 branch on the repo so I can start pushing stuff.

What are your thoughts? 😃

example runned by show me error

example runned by show me:

dyld: Library not loaded: @rpath/Presentr.framework/Presentr
Referenced from: /var/containers/Bundle/Application/6D3D3E94-376B-4F63-B379-FC559F789D65/PresentrExample.app/PresentrExample
Reason: image not found
(lldb)

Can not use completion closure with this method customPresentViewController

See this block, the completion param has been passing nil

private func presentViewController(presentingViewController presentingVC: UIViewController, presentedViewController presentedVC: UIViewController, animated: Bool, completion: (() -> Void)?){
        let transition = transitionType ?? presentationType.defaultTransitionType()
        if let systemTransition = transition.systemTransition(){
            presentedVC.modalTransitionStyle = systemTransition
        }
        presentedVC.transitioningDelegate = self
        presentedVC.modalPresentationStyle = .Custom
        presentingVC.presentViewController(presentedVC, animated: animated, completion: nil)
}

empty tableview inside viewController with custom type

hi
i have custom PresentationType with custom height and width
and inside it i have viewController that content tableview
this table view hasn't any data (some time have cells , and some times there are no cell to display)
if tableview hasn't any data then it should disable its scrole
but when user try to swipe tableview bug appear and the current view controller go to the top off screen
can help me please
thanks

Cannot change the height of the presented view controller after being presented

I'm presenting a view controller like so:

//create presented view controller
self.mUserGuideController = PresentedController(nibName: "UserGuide", bundle: nil, onDismiss: {
        print("dimissed")
})

//setup presentr
let presentr = Presentr(presentationType: .custom(width: ModalSize.custom(size: Float(((self.mInterfaceOrientation.isLandscape) ? self.view.frame.size.height : self.view.frame.size.width) - 40)), height: ModalSize.custom(size: Float(mUserGuideController.view.frame.size.height)), center: ModalCenterPosition.center))
presentr.roundCorners = false
presentr.dismissAnimated = false

//show user guide
self.customPresentViewController(presentr, viewController: self.mUserGuideController!, animated: false, completion: {
        print("shown")
})

Here is the PresentedController class:

class PresentedController: UIViewController, PresentrDelegate {
    var mOnDismiss: (()->Void)?
    
    init(nibName: String?, bundle: Bundle?, onDismiss: (()->Void)?){
        mOnDismiss = onDismiss
        super.init(nibName: nibName, bundle: bundle)
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(false)
        mOnDismiss?()
    }
}

Now, I want to change the view controller's height when orientation is changed to landscape mode, so I do this:

override func onInterfaceDidChangeOrientation(oldOrientation: UIInterfaceOrientation) {
        if mInterfaceOrientation.isLandscape {
                print("will change to landscape mode")
                self.mUserGuideController?.view.frame.size.height = self.view.frame.size.width
        }
}

However the height doesn't change. I know the code is being executed because of the log statements and the debugger , so why is the height of the controller not changing?

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 :)

Image

How can i add image on the view

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 afc2baa, 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!

how to make viewControllers contraint inside of overlay

how can i make viewController items constraint to the overlay top left right and bottom. Also when i present a view view controller over the overlay when that view controller dismiss i get the full view of the overlay and then it shrink. can this be fix.

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 😄

is it possible to present the custom view under the status bar

    lazy var presenter: Presentr = {
        let width = ModalSize.full
        let height = ModalSize.half
        let center = ModalCenterPosition.topCenter
        let customType = PresentationType.custom(width: width, height: height, center: center)
        let customPresenter = Presentr(presentationType: customType)
        customPresenter.transitionType = .coverVerticalFromTop//.CoverHorizontalFromRight
        customPresenter.roundCorners = true
        customPresenter.cornerRadius = 10
        customPresenter.backgroundColor = UIColor.black
        customPresenter.backgroundOpacity = 0.5
        return customPresenter
    }()

my presenter is defined as shown above, however i want it to show under the status bar, is that by anyway possible?

Custom background view

is it possible to customise the background and use my own view instead of the black one ?

How to set constraints?

I have a viewcontroller in storyboard, that I am using as a custom presenter. Im setting constraints for the viewcontroller, but when it shows as a custom popup, all my views are all over the place..

I'm not exactly sure how to set proper constraints to make this work, could you please guide me a little,

Thanks!

keyboardTranslationType and customPresentViewController is possible?

I can apply the keyboardTranslationType = .moveUp inside a customPresentViewController(customPresenter, viewController: cambioPasswordcontroller, animated: true, completion: nil) unfortunately this does not seem to work. This is my code:

 let presenter: Presentr = {
        let presenter = Presentr(presentationType: .alert)
        presenter.transitionType = .coverHorizontalFromRight // Optional
        return presenter
        
      
    }()
    
    let customPresenter: Presentr = {
        let width = ModalSize.full
        //let height = ModalSize.custom(size: 150)
        let height = ModalSize.default
        let center = ModalCenterPosition.center
        let customType = PresentationType.custom(width: width, height: height, center: center)
        
        let customPresenter = Presentr(presentationType: customType)
        customPresenter.transitionType = .coverHorizontalFromRight
        customPresenter.dismissTransitionType = .coverHorizontalFromRight
        customPresenter.roundCorners = false
        customPresenter.keyboardTranslationType = .moveUp
    
       // customPresenter.backgroundColor = UIColor.green
       // customPresenter.backgroundOpacity = 0.5
        return customPresenter
    }()

 customPresentViewController(customPresenter, viewController: cambioPasswordcontroller, animated: true, completion: nil)

How can I solve this problem?
thank you

Error when compiling with Carthage

my Cartfile:
github "IcaliaLabs/Presentr"

Result:

config error: 'missing_docs' is not a valid rule identifier
config error: 'function_parameter_count' is not a valid rule identifier
config error: 'cyclomatic_complexity' is not a valid rule identifier
config error: 'missing_docs' is not a valid rule identifier
config error: 'function_parameter_count' is not a valid rule identifier
config error: 'cyclomatic_complexity' is not a valid rule identifier

View controller size

Hi,
.Alert size looks hardcoded, and the others are a factor of the UITransitionView which as far as I understand is the screen size. I have view controllers that I would like to present that use autolayout to become a size, depending on content, text size and dynamic type. I'd love an option to either specify the size of the view controller being presented, that Presentr figures out the size of the presented view controller itself, or that I implement a delegate method where I calculate the view size. Do you have anything for this already, or any guidelines for me to make my changes and submit a PR?

Cheers

Nik

Popup moves after hiding keyboard

Hi,

I am using Prensentr to display a TableView and a searchBar. It works well.
When I cancel search by touching Done in keyboard, popup moves on the left side.
See screenshot.

Do you have an idea ?

1
2

Initial loading lag

Great library 👍

I just tried to use the library, found out first time load has a some initial waiting lag, the later invocations are not hurt by this issue. I didn't get a chance to look into the code to see which function is taking time, but if this is a known issue, probably an updated readme would let everyone know about it :)

Swipe to dismiss not very responsive

@danlozano

I have my alert appearing from bottomhalf above my ChatViewController which uses a UICollectionViewController. i have dissmissOnSwipe = true but you really have to struggle or try multiple times before it can actually swipe/dismiss the presentr.

How come?

Dismissing a custom view controller

Is it possible to dismiss a custom view controller from the left to right instead of from top to bottom? It seems like when i present it from right to left it still dismiss from top to bottom. What im trying to say is i want it to behave as if it was in a UINavigation controller. Thanks a bunch

Option to handle when keyboard appears

What about an option to handle keyboard appears? That could something like the following enum:

enum ActionWhenKeyboardAppears {
case Nothing
case MoveToTop
case MoveAboveKeyboard
}

Will be useful when there textfields / textview in the popup!

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

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.

Manual Installation

CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

Crash on ios8 (Presentr ver 0.2.1)

I really love your lib and I'm using quite much in my projects. It's running good in all ios version >= 9, however I just got the crash error in ios8 environment. I checked the crash error and saw that the presentingViewController was nil. I tried to fix the pod by myself but I couldn't figure why. Please help me solving this problem.

nh ch p man hinh 2016-12-21 luc 18 35 44
nh ch p man hinh 2016-12-21 luc 18 35 52
nh ch p man hinh 2016-12-21 luc 18 35 58
nh ch p man hinh 2016-12-21 luc 18 36 04
nh ch p man hinh 2016-12-21 luc 18 36 10
nh ch p man hinh 2016-12-21 luc 18 36 16
nh ch p man hinh 2016-12-21 luc 18 36 25

Supporting iOS 8 with swift 3.0

I have a project in swift 2.3 which used this library. It supports from iOS 8 and above.
Now I'm migrating the code to swift 3.0, but this library doesn't have swift 3.0 support for iOS 8.
How can use this library with swift3.0 support for iOS 8?

Can't scroll Custom ViewController after version 1.0.1!

Hi, I'm using this library make some custom viewcontroller popup, and it's scrollable TableViewController. but it doesn't scrolled when update to 1.0.1.

I think this problem caused by new added Dismiss on Swipe function, cause I disable dismissOnSwipe option, but it's still can't scrollable... I've downgrade to 1.0.0, It's works good.

Here is my video.
1.0.0
1.0.1

Accessibility

I am working with a bunch of presentr's to show various controllers throughout my app. I love it.

I am asked to do an Accessibility sweep in prep for use by government. They test using VoiceOver. When I use Voice Over, I am unable to dismiss the presented controller, by tapping outside. Also when tapping and dragging on the blurred background behind, Voice Over is reading my underlying controller interface items.

I have tried using accessibilityViewIsModal with no luck. tapToDismiss is on as well. Without Voice Over on , all works as designed.

Has anyone had any experience with this? We have to give the sight-mpaired a way to close the presented controller when voice over is on.

swift2.3crash

Presentr Version 0.2.1 , ios 8.0 is crash when dismissOnTap

  func chromeViewTapped(gesture: UIGestureRecognizer) {
        if gesture.state == .Ended && dismissOnTap {
            presentingViewController.dismissViewControllerAnimated(dismissAnimated, completion: nil)
        }
    }

ViewController doesn't show

Hi,

I tried to show my ViewController on my storyboard with

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

But it just give me blank black transparent screen. I make a sure if my view controller in storyboard has right class. But it still doesn't work.

Then I try to create ViewController with XIB and it works. My question is, is it support to show view controller on storyboard? Am I missing some step here?

Thank you!

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.