{"id":15033703,"url":"https://github.com/icalialabs/presentr","last_synced_at":"2025-05-14T15:05:00.049Z","repository":{"id":45722598,"uuid":"58604578","full_name":"IcaliaLabs/Presentr","owner":"IcaliaLabs","description":"Swift wrapper for custom ViewController presentations on iOS","archived":false,"fork":false,"pushed_at":"2023-09-20T04:55:31.000Z","size":1618,"stargazers_count":3068,"open_issues_count":35,"forks_count":269,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-04-10T10:46:03.502Z","etag":null,"topics":["alert","animation","ios","modal","presentation","transition"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IcaliaLabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-12T03:32:00.000Z","updated_at":"2025-03-26T07:10:42.000Z","dependencies_parsed_at":"2024-01-05T20:52:12.126Z","dependency_job_id":null,"html_url":"https://github.com/IcaliaLabs/Presentr","commit_stats":{"total_commits":266,"total_committers":29,"mean_commits":9.172413793103448,"dds":0.5,"last_synced_commit":"bc06d3bb7e734fb8600d8a05f99a44e3af17199d"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IcaliaLabs%2FPresentr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IcaliaLabs%2FPresentr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IcaliaLabs%2FPresentr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IcaliaLabs%2FPresentr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IcaliaLabs","download_url":"https://codeload.github.com/IcaliaLabs/Presentr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248420254,"owners_count":21100347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alert","animation","ios","modal","presentation","transition"],"created_at":"2024-09-24T20:22:25.239Z","updated_at":"2025-04-11T14:42:20.212Z","avatar_url":"https://github.com/IcaliaLabs.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"http://danielozano.com/Presentr/Screenshots/PresentrLogo.png\" width=\"700\"\u003e\n\n[![Version](https://img.shields.io/cocoapods/v/Presentr.svg?style=flat)](http://cocoapods.org/pods/Presentr)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat)](https://developer.apple.com/swift/)\n[![Platform](https://img.shields.io/cocoapods/p/Presentr.svg?style=flat)](http://cocoapods.org/pods/Presentr)\n[![License](https://img.shields.io/cocoapods/l/Presentr.svg?style=flat)](http://cocoapods.org/pods/Presentr)\n[![codebeat badge](https://codebeat.co/badges/f89d5cdf-b0c3-441d-b4e1-d56dcea48544)](https://codebeat.co/projects/github-com-icalialabs-presentr)\n![Made with Love by Icalia Labs](https://img.shields.io/badge/With%20love%20by-Icalia%20Labs-ff3434.svg)\n\n*Presentr is a simple customizable wrapper for the Custom View Controller Presentation API introduced in iOS 8.*\n\n## About\n\niOS 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.\n\nThis 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.\n\n\u003cimg src=\"http://danielozano.com/Presentr/Gifs/AlertSlow.gif\" width=\"192\"\u003e\u003cimg src=\"http://danielozano.com/Presentr/Gifs/PopupSlow.gif\" width=\"192\"\u003e\u003cimg src=\"http://danielozano.com/Presentr/Gifs/TopHalfSlow.gif\" width=\"192\"\u003e\u003cimg src=\"http://danielozano.com/Presentr/Gifs/OtherSlow.gif\" width=\"192\"\u003e\n\n*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!*\n\n## What's New\n\n#### 1.9 \n- Support for Xcode 10 / iOS 12 / Swift 4.2\n- Last version before big 2.0 update\n\n#### 1.3.1\n- New `FlipHorizontal` transition type (thanks to @falkobuttler)\n- New `CoverFromCorner` transition type (thanks to @freakdragon)\n- New `customOrientation` ModalSize (thanks to @freakdragon)\n- KeyboardTranslation now works for all Presentation Type's (thanks to @oxozle)\n- Other bug fixes \u0026 improvements\n\n#### 1.3\n- Swift 4 / Xcode 9 / iOS 11 Support\n- Bug fixes\n\n#### 1.2.0\n- You can add custom BackgroundView. (thanks to @clebta)\n- Add custom text color for AlertViewController\n- New PresentationType called .dynamic that allows dynamic sizing of ViewController using AutoLayout to calculate size.\n- You can set the context so the presentation is done properly on a child view controller and not the whole screen.\n- You can also set the behavior for a tap outside the context.\n- Simpler PresentrAnimation architecture. Simpler to modify existing transition animations or create your own.\n- Two new animations to replace system ones, CoverVertical \u0026 CrossDissolve.\n- All animations are now Presentr's, no more Apple animations. This allows greater control \u0026 less bugs.\n- Swipe to dismiss feature greatly improved.\n- Bug fixes and other small improvements.\n\n#### 1.1.0\n- You are now able to create your own custom transition animations. See how in readme. (thanks to @fpg1503 \u0026 @danlozano)\n- New animation available, coverVerticalWithSpring (thanks to @fpg1503)\n\n#### See CHANGELOG.md for previous\n\n## Contributing\n\n1. Fork project\n2. Checkout **Develop** branch\n3. Create **Feature** branch off of the **Develop** branch\n4. Create awesome feature/enhancement/bug-fix\n5. Optionally create *Issue* to discuss feature\n6. Submit pull request from your **Feature** branch to Presentr’s **Develop** branch\n\n## Supported Swift Versions\n\n| Presentr Version   |      Swift Version      |    Min. iOS Version      |\n|----------|:-------------:|:-------------:|\n| \u003c= 0.1.8 |  Swift 2.2  | \u003e= iOS 8.0  |\n| == 0.2.1 |    Swift 2.3 | \u003e= iOS 8.0 |\n| \u003e= 1.0.0 | Swift 3.0 | \u003e= iOS 9.0 |\n| \u003e= 1.3 | Swift 4.0 | \u003e= iOS 9.0 |\n| \u003e= 1.9 | Swift 4.0 \u0026 Swift 4.2 | \u003e= iOS 9.0 |\n\n\n## Installation\n\n### [Cocoapods](http://cocoapods.org)\n\n```ruby\nuse_frameworks!\n\npod 'Presentr'\n```\n\n### [Carthage](https://github.com/Carthage/Carthage)\nAdd Presentr to you `Cartfile`\n```sh\ngithub \"IcaliaLabs/Presentr\"\n```\nInstall using\n```sh\ncarthage update --platform ios\n```\n\n### Manually\n1. Download and drop ```/Presentr``` folder in your project.  \n2. You're done!\n\n## Getting started\n\n### Create a Presentr object\n\nIt 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.\n\nYour **Presentr** can be as simple as this:\n\n```swift\nclass ViewController: UIViewController {\n\n  let presenter = Presentr(presentationType: .alert)\n\n}\n```\n\nOr as complex as this:\n\n```swift\nclass ViewController: UIViewController {\n\n  let presenter: Presentr = {\n        let width = ModalSize.full\n        let height = ModalSize.fluid(percentage: 0.20)\n        let center = ModalCenterPosition.customOrigin(origin: CGPoint(x: 0, y: 0))\n        let customType = PresentationType.custom(width: width, height: height, center: center)\n\n        let customPresenter = Presentr(presentationType: customType)\n        customPresenter.transitionType = .coverVerticalFromTop\n        customPresenter.dismissTransitionType = .crossDissolve\n        customPresenter.roundCorners = false\n        customPresenter.backgroundColor = .green\n        customPresenter.backgroundOpacity = 0.5\n        customPresenter.dismissOnSwipe = true\n        customPresenter.dismissOnSwipeDirection = .top\n        return customPresenter\n    }()\n\t\n}\n```\n\n### Present the view controller.\n\nInstantiate the View Controller you want to present and use the customPresentViewController method along with your **Presentr** object to do the custom presentation.\n\n```swift\nlet controller = SomeViewController()\ncustomPresentViewController(presenter, viewController: controller, animated: true, completion: nil)\n```\n\nThis is a helper method provided for you as an extension on UIViewController. It handles setting the Presentr object as the delegate for the presentation \u0026 transition.\n\nRemember to setup Auto Layout on the ViewController so it can be displayed well on any size.\n\nThe PresentationType (and all other properties) can be changed later on in order to reuse the **Presentr** object for other presentations.\n\n```swift\npresenter.presentationType = .popup\n```\n\n## Main Types\n\n### Presentation Type\n\n```swift\npublic enum PresentationType {\n\n  case alert\n  case popup\n  case topHalf\n  case bottomHalf\n  case fullScreen\n  case dynamic(center: ModalCenterPosition)\n  case custom(width: ModalSize, height: ModalSize, center: ModalCenterPosition)\n  \n}\n```\n#### Alert \u0026 Popup\n\n\u003cimg src=\"http://danielozano.com/Presentr/Gifs/AlertSlow.gif\" width=\"250\"\u003e\u003cimg src=\"http://danielozano.com/Presentr/Gifs/PopupSlow.gif\" width=\"250\"\u003e\n\n#### BottomHalf \u0026 TopHalf\n\n\u003cimg src=\"http://danielozano.com/Presentr/Gifs/BottomHalfSlow.gif\" width=\"250\"\u003e\u003cimg src=\"http://danielozano.com/Presentr/Gifs/TopHalfSlow.gif\" width=\"250\"\u003e\n\n### Transition Type\n\n```swift\npublic enum TransitionType {\n\n  case coverVertical\n  case crossDissolve\n  case coverVerticalFromTop\n  case coverHorizontalFromRight\n  case coverHorizontalFromLeft\n  case custom(PresentrAnimation)\n  \n}\n```\n\n## Properties\n\n#### Properties are optional, as they all have Default values.\n\nThe only required property for **Presentr** is the **PresentationType**. You initialize the object with one, but it can be changed later on.\n\n```swift\npresenter.presentationType = .popup\n```\n\nYou can choose a TransitionType, which is the animation that will be used to present or dismiss the view controller.\n\n```swift\npresenter.transitionType = .coverVerticalFromTop\npresenter.dismissTransitionType = .crossDissolve\n```\n\nYou can change the background color \u0026 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.\n\n```swift\npresenter.backgroundColor = UIColor.red\npresenter.backgroundOpacity = 1.0\npresenter.customBackgroundView = UIView()\n```\n\nYou 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.\n\n```swift\npresenter.blurBackground = true\npresenter.blurStyle = UIBlurEffectStyle.light\n```\n\nYou can choose to disable rounded corners on the view controller that will be presented.\n\n```swift\npresenter.roundCorners = false\n```\n\nIf set to true you can modify the cornerRadius.\n\n```swift\npresenter.cornerRadius = 10\n```\n\nUsing the **PresentrShadow** struct can set a custom shadow on the presented view controller.\n\n```swift\nlet shadow = PresentrShadow()\nshadow.shadowColor = .black\nshadow.shadowOpacity = 0.5\nshadow.shadowOffset = CGSize(5,5)\nshadow.shadowRadius = 4.0\n\npresenter.dropShadow = shadow\n```\n\nYou 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.\n\n```swift\npresenter.dismissOnTap = false\npresenter.dismissAnimated = false\n```\n\nYou 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.\n\nYou 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.\n\n```swift\npresenter.dismissOnSwipe = true\npresenter.dismissOnSwipeDirection = .top\n```\n\nIf 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.\n\n```swift\npresenter.keyboardTranslationType = .none\npresenter.keyboardTranslationType = .moveUp\npresenter.keyboardTranslationType = .compress\npresenter.keyboardTranslationType = .stickToTop\n```\n\nIf 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.\n\nSet 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).\n\nBe 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.\n\n```swift\n@IBAction func didSelectShowAlert(_ sender: Any) {\n\tpresenter.viewControllerForContext = self\n\tpresenter.shouldIgnoreTapOutsideContext = true\n\tcustomPresentViewController(presenter, viewController: alertController, animated: true, completion: nil)\n}\n```\n\n## Other / Advanced\n\n- [Built in AlertViewController](https://github.com/IcaliaLabs/Presentr/blob/master/ALERT.md)\n- [PresentrDelegate](https://github.com/IcaliaLabs/Presentr/blob/master/DELEGATE.md)\n- [PresentationType customization \u0026 more](https://github.com/IcaliaLabs/Presentr/blob/master/PRESENTATIONTYPE.md)\n- [TransitionType customization, PresentrAnimation \u0026 more](https://github.com/IcaliaLabs/Presentr/blob/master/TRANSITIONTYPE.md)\n\n## Requirements\n\n* iOS 9.0+\n* Xcode 8.0+\n* Swift 3.0+\n\n## Documentation\n\nRead the [docs](http://danielozano.com/Presentr/Docs/). \n\n##  Author\n[Daniel Lozano](http://danielozano.com) \u003cbr\u003e\n\n## Main Contributors\n[Gabriel Peart](http://swiftification.org/)\n\u003cbr\u003e\u003cbr\u003e\nLogo design by [Eduardo Higareda](http://eldelentes.mx)\u003cbr\u003e\nAlert design by [Noe Araujo](http://www.noearaujo.com)\n\n## License\nPresentr is released under the MIT license.  \nSee LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficalialabs%2Fpresentr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficalialabs%2Fpresentr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficalialabs%2Fpresentr/lists"}