Skip to content

VolleyZ/ETPopupView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ETPopupView

CocoaPods CocoaPods CocoaPods

Swift version of MMPopupView.

demo

Installation

The preferred way of installation is via CocoaPods. Just add

pod 'ETPopupView'

and run pod install. It will install the most recent version of ETPopupView.

Usage

If you want to create your own Pop-Up view,simply you only need to subclass from ETPopupView.

class CustomView: ETPopupView {

    let SCREEN_WIDTH = UIScreen.main.bounds.width

    override func awakeFromNib() {
        super.awakeFromNib()
        
        animationDuration = 0.3
        type = .alert
        
        ETPopupWindow.sharedWindow().touchWildToHide = true
        
        self.snp.makeConstraints { (make) in
            make.width.equalTo(SCREEN_WIDTH*0.8)
            make.height.equalTo(214)
        }
    }
}

after you customize it, you can simply use it.

  let customView = Bundle.main.loadNibNamed("CustomView", owner: nil, options: nil)?.first as! CustomView
  customView.show()

ETPopupView

ETPopupView is a basic Pop-Up view designed to be subclassed. It provide 3 kind of animations(alert, sheet,Drop), or you can provide your own animation by override the showAnimation and hideAnimation.

enum ETPopupType {
    case alert
    case sheet
    case custom
}

typealias ETPopupBlock = (ETPopupView) -> Void
typealias ETPopupCompletionBlock = (ETPopupView, Bool) -> Void

class ETPopupView: UIView {
    
    open var type: ETPopupType = .alert
    
    open var animationDuration: TimeInterval = 0.3
    
    open var visible: Bool
    
    open var attachedView: UIView
    
    open var showCompletionBlock: ETPopupCompletionBlock?
    open var hideCompletionBlock: ETPopupCompletionBlock?
    
    open var showAnimation: ETPopupBlock?
    open var hideAnimation: ETPopupBlock?
}

Requirements

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

Contributing

  1. Create an issue to discuss about your idea
  2. Fork it (https://github.com/VolleyZ/ETPopupView/fork)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request