LSDialogViewController
is able to easily display a custom view as a dialog.
Requirement
- Swift 2+ (Swift 4.2 is ready
👍 ) - iOS 8.0+
Installation
From CocoaPods
LSDialogViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:
# for Swift 4.2
pod 'LSDialogViewController', '~> 3.0'
# for Swift 3
pod 'LSDialogViewController', '~> 0.1.9'
# for Swift 2
pod 'LSDialogViewController', '0.1.0'
From Carthage
Add this to Cartfile.
github "daihase/LSDialogViewController"
And then, run this command.
$ carthage update
Usage
To run the example project, clone the repo, and run pod install
from the Example directory first.
Examples
import LSDialogViewController
// to show the dialog
let dialogViewController: CustomDialogViewController = CustomDialogViewController(nibName:"CustomDialog", bundle: nil)
dialogViewController.delegate = self
self.presentDialogViewController(dialogViewController, animationPattern: animationPattern, completion: { () -> Void in })
// to dismiss the dialog
self.dismissDialogViewController(animationPattern)
Configuration
presentDialogViewController(
// required
dialogViewController: :UIViewController,
// default LSAnimationPattern.FadeInOut
animationPattern: LSAnimationPattern,
// default LSDialogBackgroundViewType.Solid
backgroundViewType: LSDialogBackgroundViewType,
// default true
dismissButtonEnabled: Bool,
// optional
completion: (() -> Swift.Void)?
)
Other background view type. (.Gradient .None)
License
LSDialogViewController is available under the MIT license. See the LICENSE file for more info.