/LSDialogViewController

Custom Dialog for iOS written in Swift

Primary LanguageSwiftMIT LicenseMIT

Language: Swift 5.0 License Platform CocoaPodsDL Carthage Compatible

LSDialogViewController is able to easily display a custom view as a dialog.

LSDialogViewController_animation

Requirement

  • Swift 2+ (Swift 5 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 5.0
pod 'LSDialogViewController', '~> 4.0'

# for Swift 4.2
pod 'LSDialogViewController', '~> 3.0'

# for Swift 3
pod 'LSDialogViewController', '~> 0.1.9'

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)

Image . Image

License

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