Swift version of MMPopupView.
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.
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 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?
}
- iOS 8.0+
- Xcode 8.0+
- Swift 3.0+
- Create an issue to discuss about your idea
- Fork it (https://github.com/VolleyZ/ETPopupView/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request