To run the example project, clone the repo, and run pod install
from the Example directory first.
PopKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "PopKit"
To use PopKit is extremenly simple. Use PopKitBuilder to initialise your popup view. Create your own custom UIView or UIViewcontroller and add that to either the popupView or popupViewController property depending on which type of view you are using. Have a look at the samples below for some example uses. A proper example project is in the works still ;)
var sideMenu: PopKit {
return PopKitBuilder() {
$0.constraints = [.edges(left: 0, right: nil, top: 0, bottom: 0), .width(275)]
$0.inAnimation = .bounceFromLeft(damping: 0.82, velocity: 2, animationOption: .curveEaseInOut)
$0.outAnimation = .bounceFromRight(damping: 0.72, velocity: 2, animationOption: .curveEaseInOut)
$0.backgroundEffect = .blurDark
$0.popupViewController = SideMenuViewController.fromStoryboard()
}
}
sideMenu.show()
To dismiss the popup, simply call Popkit.dismiss() from anywhere
var topNotification: PopKit {
return PopKitBuilder() {
$0.constraints = [.edges(left: 0, right: 0, top: 0, bottom:nil), .height(90)]
$0.inAnimation = .bounceFromTop(damping: 0.9, velocity: 2, animationOption: .curveEaseInOut)
$0.outAnimation = .bounceFromBottom(damping: 0.86, velocity: 2, animationOption: .curveEaseInOut)
$0.backgroundEffect = .blurDark
$0.transitionSpeed = 0.3
$0.popupView = NotificationView.loadView()
}
}
topNotification.show()
var bottomMenu: PopKit {
return PopKitBuilder() {
$0.constraints = [.edges(left: 0, right: 0, top: nil, bottom:0), .height(400)]
$0.inAnimation = .bounceFromBottom(damping: 0.86, velocity: 2, animationOption: .curveEaseInOut)
$0.outAnimation = .bounceFromTop(damping: 0.72, velocity: 2, animationOption: .curveEaseInOut)
$0.backgroundEffect = .transparentOverlay(0.5)
$0.transitionSpeed = 0.3
$0.popupView = TestView(radius: 0)
}
}
bottomMenu.show()
var bounceFromTop: PopKit {
return PopKitBuilder() {
$0.constraints = [.center(x: 0, y: 0), .width(300), .height(350)]
$0.inAnimation = .bounceFromTop(damping: 0.72, velocity: 2, animationOption: .curveEaseInOut)
$0.outAnimation = .bounceFromBottom(damping: 0.86, velocity: 2, animationOption: .curveEaseInOut)
$0.backgroundEffect = .blurDark
$0.popupView = CenterModalView.loadView()
}
}
bounceFromTop.show()
var slideFromBottom: PopKit {
return PopKitBuilder() {
$0.constraints = [.center(x: 0, y: 0), .width(300), .height(300)]
$0.inAnimation = .slideFromBottom(animationOption: .curveEaseOut)
$0.outAnimation = .slideFromTop(animationOption: .curveEaseInOut)
$0.backgroundEffect = .blurDark
$0.transitionSpeed = 0.3
$0.popupView = TestView()
}
}
slideFromBottom.show()
var zoomIn: PopKit {
return PopKitBuilder() {
$0.constraints = [.center(x: 0, y: 0), .width(300), .height(300)]
$0.inAnimation = .zoomOut(1.2, animationOption: .curveEaseInOut)
$0.outAnimation = .bounceFromBottom(damping: 0.86, velocity: 2, animationOption: .curveEaseInOut)
$0.backgroundEffect = .blurDark
$0.transitionSpeed = 0.46
$0.popupView = TestView()
}
}
zoomIn.show()
There's still a lot of work to do here! We would love to see you involved!
If you have any questions, you can find the core team on twitter:
- @rohan_jansen
- [Andreas ] (andreas409@gmail.com)
rohan-jansen, rohanjansen@gmail.com
PopKit is available under the MIT license. See the LICENSE file for more info.