MKAPopup 1.3.1

MKAPopup 1.3.1

Maintained by Hituzi Ando.



MKAPopup 1.3.1

  • By
  • Hituzi Ando

MKAPopup

MKAPopup is simple and customizable popup view written in Swift for iOS.

Objective-C version is here.

Requirements

  • Swift 5.0+

Installation

CocoaPods

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

pod "MKAPopup"

Carthage

You can use Carthage to install SebasSwift by adding it to your Cartfile:

github "HituziANDO/MKAPopup"

If you use Carthage to build your dependencies, make sure you have added MKAPopup.framework to the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase.

Manual Installation

  1. Download latest MKAPopup framework and copy it into your Xcode project
  2. Open the "General" panel
  3. Click on the + button under the "Embedded Binaries" section
  4. After click "Add Other...", choose MKAPopup.framework

Quick Usage

Let's see following code.

import MKAPopup

...

// Creates your content view.
let contentView = ...YOUR CONTENT VIEW CREATION...
// Creates a popup using your content view.
let popup       = MKAPopup(contentView: contentView)

// Customizes...

// Title (default is nil)
popup.popupView.titleLabel.text = "About Swift"

// Title Text Color (default is system default color)
popup.popupView.titleLabel.textColor = .white

// Title Font (default is system default font)
popup.popupView.titleLabel.font = UIFont.boldSystemFont(ofSize: 20.0)

// Title Text Padding (default is (16, 16, 16, 16))
popup.popupView.titleLabel.padding = UIEdgeInsets(top: 24.0, left: 16.0, bottom: 24.0, right: 16.0)

// Popup Background Color (default is white)
popup.popupView.backgroundColor = UIColor(red: 0, green: 0.5, blue: 1.0, alpha: 1.0)

// Popup Corner Radius (default is 5)
popup.popupView.layer.cornerRadius = 20.0

// Popup Size (default is (300, 400))
popup.popupSize = CGSize(width: 320.0, height: 480.0)

// Overlay Color (default is black with alpha=0.4)
popup.backgroundColor = UIColor.black.withAlphaComponent(0.8)

// Can hide when a user touches up outside a popup (default is true)
popup.canHideWhenTouchUpOutside = false

// Showing Animation (default is fade)
popup.showingAnimation = .fade

// Hiding Animation (default is fade)
popup.hidingAnimation = .fade

// Animation Duration (default is 0.3)
popup.duration = 0.3

// Delegate
popup.delegate = self

// Shows the popup.
popup.show()

...

// Hides the popup.
popup.hide()

Animation Types

Fade

SlideUp

SlideDown

SlideLeft

SlideRight