PopupKit alternatives and similar libraries
Based on the "Popup" category.
Alternatively, view PopupKit alternatives based on common mentions on social networks and blogs.
-
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
LNPopupController
LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps. -
STPopup
STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad. It's written in Objective-C and compatible with Swift. -
MMPopupView
Pop-up based view(e.g. alert sheet), can be easily customized. -
CNPPopupController
Simple and versatile class for presenting a custom popup in a variety of fashions. It includes a many options for controlling how your popup appears and behaves. -
KLCPopup
A simple and flexible class for presenting custom views as a popup in iOS. -
AZDialogViewController
A highly customizable alert dialog controller that mimics Snapchat's alert dialog. -
MIBlurPopup
MIBlurPopup lets you create popups with a blurred background -
PopupWindow
PopupWindow is a simple Popup using another UIWindow in Swift -
PopupController
PopupController is a controller for showing temporary popup view. -
SubscriptionPrompt
Subscription View Controller like the Tinder uses -
NMPopUpView
Simple Swift class for iOS that shows nice popup windows with animation. -
PBPopupController
A framework for presenting bars and view controllers as popup, much like the look and feel of Apple Music App.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of PopupKit or a related project?
README
PopupKit
PopupKit is a simple and flexible iOS framework for presenting any custom view as a popup. It includes a variety of options for controlling how your popup appears and behaves.
Installation
CocoaPods
You can install PopupKit easily with Cocoapods
pod 'PopupKit'
CocoaPods
You can install PopupKit easily with Carthage too
github 'rynecheow/PopupKit'
Usage
To import the framework you can either:
In Swift,
import PopupKit
In Objective-C,
@import PopupKit;
or
#import <PopupKit/PopupView.h>
Creating a Popup
Create a popup for displaying a UIView using default animations and behaviors (similar to a UIAlertView):
+ (instancetype)popupWithContentView:(UIView*)contentView;
or similarly in Swift:
convenience init(contentView: UIView)
Or create a popup with custom animations and behaviors. Customizations can also be accessed via properties on the popup instance:
+ (instancetype)popupViewWithContentView:(UIView *)contentView
showType:(PopupViewShowType)showType
dismissType:(PopupViewDismissType)dismissType
maskType:(PopupViewMaskType)maskType
shouldDismissOnBackgroundTouch:(BOOL)shouldDismissOnBackgroundTouch
shouldDismissOnContentTouch:(BOOL)shouldDismissOnContentTouch;
or similarly in Swift:
convenience init(contentView: UIView, showType: PopupView.ShowType, dismissType: PopupView.DismissType, maskType: PopupView.MaskType, shouldDismissOnBackgroundTouch: Bool, shouldDismissOnContentTouch: Bool)
Also you must give your contentView
a size before showing it (by setting its frame), or it must size itself with AutoLayout.
Showing a Popup
Show popup in middle of screen.
- (void)show;
or similarly in Swift:
func show()
There are two ways to control where your popup is displayed:
- Relative layout presets (see
PopupView.h
for options).
- (void)showWithLayout:(PopupViewLayout)layout;
or similarly in Swift:
func show(with layout: PopupView.Layout)
- Explicit center point relative to a view's coordinate system.
objc - (void)showAtCenter:(CGPoint)center inView:(UIView *)view;
or similarly in Swift:
func show(at center: CGPoint, in view: UIView)
If you want your popup to dismiss automatically (like a toast in Android) you can set an explicit duration
:
- (void)showWithDuration:(NSTimeInterval)duration;
or similarly in Swift:
func show(with duration: TimeInterval)
Dismissing a Popup
There are a few ways to dismiss a popup:
If you have a reference to the popup instance, you can send this message to it. If animated
, then it will use the animation specified in dismissType
. Otherwise it will just disappear:
- (void)dismiss:(BOOL)animated;
or similarly in Swift:
func dismiss(animated: Bool)
If you lost your reference to a popup or you want to make sure no popups are showing, this class method dismisses any and all popups in your app:
+ (void)dismissAllPopups;
or similarly in Swift:
class func dismissAllPopups()
Also you can call this category method from UIView(PopupView)
on your contentView, or any of its subviews, to dismiss its parent popup:
- (void)dismissPresentingPopup; // UIView category
or similarly in Swift:
func dismissPresentingPopup()
Customization
Animation used to show your popup:
@property (nonatomic, assign) PopupViewShowType showType;
Animation used to dismiss your popup:
@property (nonatomic, assign) PopupViewDismissType dismissType;
Mask prevents touches to the background from passing through to views below:
@property (nonatomic, assign) PopupViewMaskType maskType;
Popup will automatically dismiss if the background is touched:
@property (nonatomic, assign) BOOL shouldDismissOnBackgroundTouch;
Popup will automatically dismiss if the contentView is touched:
@property (nonatomic, assign) BOOL shouldDismissOnContentTouch;
Override alpha value for dimmed background mask:
@property (nonatomic, assign) CGFloat dimmedMaskAlpha;
Blocks
Use these blocks to synchronize other actions with popup events:
@property (nonatomic, copy) void (^didFinishShowingCompletion)();
@property (nonatomic, copy) void (^willStartDismissingCompletion)();
@property (nonatomic, copy) void (^didFinishDismissingCompletion)();
Example
UIView* contentView = [[UIView alloc] init];
contentView.backgroundColor = [UIColor orangeColor];
contentView.frame = CGRectMake(0.0, 0.0, 100.0, 100.0);
PopupView* popup = [PopupView popupWithContentView:contentView];
[popup show];
Notes
- Xcode 8.0 / Swift 3.0
- iOS >= 9.0 (Use as an Embedded Framework)
- tvOS >= 9.0
TODO
- Add support for drag-to-dismiss.
Credits
KLCPopup was created by Jeff Mascia and the team at Kullect, where it's used in the Shout Photo Messenger app. Aspects of KLCPopup were inspired by Sam Vermette's SVProgressHUD. PopupKit is a modernised version of KLCPopup ported by Ryne Cheow.