Latest 0.0.2
Homepage https://github.com/snail-z/OverlayController-Swift
License MIT
Platforms ios 8.0, requires ARC
Authors

OverlayController-Swift

Swift 3.0
enter image description here
enter image description here
OverlayController

OverlayController is an implementation of a overlay effect for any view. It can be used to easily add dynamics to user interactions and popups views.

Objective-C version is here.

Installation

To install OverlayController using [CocoaPods](https://cocoapods.org "CocoaPods" ), please integrate it in your existing Podfile, or create a new Podfile:

    platform :ios, '8.0'
    use_frameworks!

    target 'You Project' do
      pod 'OverlayController', '~> 0.0.2'
    end

Then run pod install.

Example

image
image
image

image
image
image

Requirements

  • Swift 3.0
  • iOS 8 or higher

Update

  • Add elastic animation, set by isUsingElastic
    open var isUsingElastic = false // Using elastic animation
  • Add transition effects, set by TransitionStyle -> FromCenter
    public enum TransitionStyle {
    case CrossDissolve, Zoom, FromTop, FromBottom, FromLeft, FromRight, FromCenter
    }
  • Add the corresponding delegate method.
    /**
    - Protocol -
    ! OverlayControllerDelegate
    */
    @objc protocol OverlayControllerDelegate: class {
    // WillPresent delegate to be executed before the view is presented.
    @objc optional func overlayControllerWillPresent(overlayController: OverlayController)
    @objc optional func overlayControllerDidPresent (overlayController: OverlayController)
    @objc optional func overlayControllerWillDismiss(overlayController: OverlayController)
    @objc optional func overlayControllerDidDismiss (overlayController: OverlayController)
    }

    More details, please see the demo.
     

    Usage


    var overlayController : OverlayController!

    overlayController = OverlayController(aView: customView, overlayStyle: .BlackTranslucent)
    overlayController.present(animated: true)
  • ¬†Properties

    
    open var presentationStyle: PresentationStyle = .Centered
    open var transitionStyle: TransitionStyle = .CrossDissolve
    open var overlayAlpha: CGFloat = 0.5
    open var animateDuration: TimeInterval = 0.25
    open var isAllowOverlayTouch = true
    open var isAllowDrag   = false
    
    /**
     The view disappear in the opposite direction.
     - set default value is false!
     */
    open var isDismissedOppositeDirection = false
    
    // Using elastic animation
    open var isUsingElastic = false 
    
  • Delegate

    
    // MARK: - OverlayControllerDelegate
    
    func overlayControllerWillPresent(overlayController: OverlayController) {
        print("overlayControllerWillPresent~")
    }
    
    func overlayControllerDidPresent(overlayController: OverlayController) {
        print("overlayControllerDidPresent~")
    }
    
    func overlayControllerWillDismiss(overlayController: OverlayController) {
        print("overlayControllerWillDismiss~")
    }
    
    func overlayControllerDidDismiss(overlayController: OverlayController) {
        print("overlayControllerDidDismiss~")
    }
    

License

OverlayController is distributed under the MIT license.

Latest podspec

{
    "name": "OverlayController",
    "version": "0.0.2",
    "summary": "Simple Overlay Controller. Written in Swift",
    "license": {
        "type": "MIT",
        "file": "LICENCE"
    },
    "authors": {
        "snail-z": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "homepage": "https://github.com/snail-z/OverlayController-Swift",
    "source": {
        "git": "https://github.com/snail-z/OverlayController-Swift.git",
        "tag": "0.0.2"
    },
    "source_files": "OverlayController/*.{swift}",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This