A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.
- iOS 12.0+
- Swift 5.5+
- Xcode 10.0+
File > Add Packages > https://github.com/donggyushin/DGAlertView
pod 'DGAlertView', :git => 'https://github.com/donggyushin/DGAlertView'
func showAlert() {
let view: UIView = {
let view = UIView()
view.backgroundColor = .white
view.translatesAutoresizingMaskIntoConstraints = false
// Make sure give view height anyway
view.heightAnchor.constraint(equalToConstant: 200).isActive = true
return view
}()
let vc = DGAlertView(view)
// Make sure animated false
present(vc, animated: false)
}
// Hide DGAlertView programmatically
let vc = DGAlertView(view)
vc.hide()