Skip to content

fintech-path/ios-popup

Repository files navigation

HCCPopup

Swift Platforms Version CocoaPods Compatible License

About

A syntactic sugar library of UIViewControllerTransitioningDelegate.

Related documents from Apple: Creating Custom Presentations

Screenshot

screenshot_0 screenshot_1

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Release notes

1.0.0

  • Predefined alignments: topLeft, topRight, bottomLeft, bottomRight, center
  • Custom alignment: custom
  • Predefined animations: horizontal, vertical, center, reversed
  • Custom animation: support custom CGAffineTransform

Documentation

Requirements

iOS 9.0+

swift 5+

Installation

HCCPopup is a Private Pod for now. To install it, simply add the following line to your Podfile:

pod 'HCCPopup' , :git => 'https://github.com/hccxc/ios-popup.git'

Usage

Popup.Alignment

The .custom(x:y:) case in a rectangle with height h and width w describes the origin point (x * w/2 + w/2, y * h/2 + h/2) in the coordinate system of the rectangle.

Popup

// Hold your `Popup`
let popup = Popup()
popup.configuration = .init(isDismissible: isDismissible, alignment: alignment, scaleX: scaleX, scaleY: scaleY, animation: animation)
// For `presentedViewController`
// Set `Popup` as `transitioningDelegate` of `presentedViewController`
// Set `modalPresentationStyle` to `.custom`
presented.transitioningDelegate = popup
presented.modalPresentationStyle = .custom
someViewController.present(presented, animated: true)

UIViewController extension

let viewController = UIViewController()
let config = Popup.Configuration(isDismissible: isDismissible, alignment: alignment, scaleX: scaleX, scaleY: scaleY, animation: animation)
// `pup` is a readonly `Popup` instance
viewController.pup(config).present(vcToPresent, animated: true)

License

HCCPopup is available under the Apache 2.0 license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published