LSDialogViewController makes it easy to display a custom view as a dialog with various animation patterns.
- Swift 5.0+
- iOS 12.0+
Add the following to your Package.swift:
dependencies: [
.package(url: "https://github.com/daihase/LSDialogViewController.git", from: "4.1")
]Or in Xcode: File → Add Package Dependencies... → Enter the repository URL:
https://github.com/daihase/LSDialogViewController.git
LSDialogViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'LSDialogViewController', '~> 4.0'Add the following to your Cartfile:
github "daihase/LSDialogViewController"Then run:
$ carthage update
To run the example project, clone the repo and run pod install from the Example directory.
There is also an SPM-based example in the ExampleSPM directory — just open ExampleSPM.xcodeproj and build.
import LSDialogViewController
// Show a dialog
let dialogViewController = CustomDialogViewController(nibName: "CustomDialog", bundle: nil)
dialogViewController.delegate = self
presentDialogViewController(dialogViewController, animationPattern: .fadeInOut)
// Dismiss the dialog
dismissDialogViewController(.fadeInOut)presentDialogViewController(
// Required: the view controller to display as a dialog
dialogViewController: UIViewController,
// Animation pattern (default: .fadeInOut)
animationPattern: LSAnimationPattern,
// Background view type (default: .solid)
backgroundViewType: LSDialogBackgroundViewType,
// Whether tapping the background dismisses the dialog (default: true)
dismissButtonEnabled: Bool,
// Called after the dialog is presented
completion: (() -> Swift.Void)?
)You can choose from .solid, .gradient, or .none:
LSDialogViewController is available under the MIT license. See the LICENSE file for more info.



