IDPopup 1.2.0

IDPopup 1.2.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2017
SwiftSwift Version 3.1
SPMSupports SPM

Maintained by Michael Schoder.


Downloads

Total13
Week0
Month0

Installs

Apps2
powered by Segment

GitHub

Stars0
Watchers0
Forks0
Issues0
Contributors1
Pull Requests0

Code

Files4
LOCLines of Code 361


IDPopup 1.2.0

  • By
  • Michael Schoder

IDPopup is a easy to use Pod to show Popups on the bottom of the Screen indepentend from the view hierarchy of your app.

Alt Text

General Usage

Create a IDPopup with one of this constructor:

let popup = IDPopup(text: "Default IDPopup")
let popup = IDPopup(text: "Default IDPopup\nDismissed after 5sec", dismissAfter: 5)
let popup = IDPopup(text: "Default IDPopup\nDismissable Popup", isDismissable: true)

Show a IDPopup:

popup.show()

Dismiss a IDPopup:

popup.dismiss()
popup.dismiss(afer: 5)
IDPopup.dismissAll()

Styling an IDPopup

IDPopup ships with five styles of Popups:

  • IDPopup: Popup with white Background. For General Use.
  • IDErrorPopup: Popup with red Background.
  • IDWarningPopup: Popup with yellow Background.
  • IDSuccessPopup: Popup with green Background.
  • IDDebugPopup: Popup with grey Background.

You can create you own style of Popups by subclassing IDPopup or one of its childs.

Anatomy of an IDPopup

A IDPopup has in the center a UILabel which can show two lines of text.

To the right of the Label is a UIButton with an aspect ratio of 1:1.

To the left of the Label is a UIImageView for a thumb. (By default the image is nil).

Configure IDPopups

IDPopup are configured by the IDPopupConfiguration.

  • leftPopupInset: Constant of the left Inset of IDPopups to the right screen-edge
  • rightPopupInset: Constant of the right Inset of IDPopups to the right screen-edge.
  • popupDistance: Distance between IDPopups or the bottom of the screen.
  • maxPopupCount: Defines the maximum amount of IDPopups which are allowed to be shown on the Screen..
  • ignoredPopupClasses: Array of IDPopup Types and subclasses of this Types, which should not be diplayed.

With the IDPopupConfiguration you can configure, that IDDebugPopups are only shown for a Dev App:

#if DEBUG
  IDPopupConfiguration.current.ignoredPopupClasses = []
#else
  IDPopupConfiguration.current.ignoredPopupClasses = [IDDebugPopup.self]
#endif

Update a IDPopup

Set the Variables of an IDPopup

The text, thumbImage, buttonImage and isDismissable are updatable can be changed at every time.

Setup an IDPopup to be updatable

IDPopup has an Update-Engine integrated.

  1. Assign an identifier to an IDPopup:
IDPopup(identifier:"default_popup", text: "Default IDPopup").show()
  1. Done

When an IDPopup has an identifier and a Popup with the same identifier is already presented, the text of the old popup updates, the popup shakes and the dismissTimer is resetted.

Installation

IDPopup is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "IDPopup"

Author

Michael Schoder, [email protected]

License

IDPopup is available under the MIT license. See the LICENSE file for more info.

Popup Thumbs and Button Image are provided by https://icons8.com