LSDialogViewController
is able to easily display a custom view as a dialog.
- Swift 2+ (Swift 5 is ready 👍)
- iOS 8.0+
LSDialogViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:
# for Swift 5.0
pod 'LSDialogViewController', '~> 4.0'
# for Swift 4.2
pod 'LSDialogViewController', '~> 3.0'
# for Swift 3
pod 'LSDialogViewController', '~> 0.1.9'
Add this to Cartfile.
github "daihase/LSDialogViewController"
And then, run this command.
$ carthage update
To run the example project, clone the repo, and run pod install
from the Example directory first.
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)
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)
LSDialogViewController is available under the MIT license. See the LICENSE file for more info.