UmaBasicAlertKit is a Swift UI library for iOS. This library allows user to use variations of Apple's default pop up alert with one line of code.
UmaBasicAlertKit can be installed with Swift Package Manager.
Swift Package Manager (Xcode 12 or higher) The preferred way of installing KatKit is via the Swift Package Manager.
In Xcode, open your project and navigate to File → Swift Packages → Add Package Dependency... Paste the repository URL (https://github.com/umaKim/UmaBasicAlertKit.git) and click Next. For Rules, select Version (Up to Next Major) and click Next. Click Finish.
In order to use the methods, Alertable should be implemented by your viewController.
class ViewController: UIViewController, Alertable {
}
showDefaultAlert(title: "Title")
showDefaultAlert(title: "Tile", message: "Message")
showDefaultAlert(title: "Cancel Button Pop up", isCancelActionIncluded: true)
showDefaultAlert(title: "Pop up with completion", message: "press ok ", isCancelActionIncluded: true, actionCancelButtonTitle: "Cancel") { action in
self.view.backgroundColor = .yellow
}
let action = UIAlertAction(title: "change background to Red", style: .default) { action in
self.view.backgroundColor = .red
}
showActionAlert(title: "You can add custom alert action", isCancelActionIncluded: true, with: action)
let actionR = UIAlertAction(title: "change background color to Red", style: .default) { action in
self.view.backgroundColor = .red
}
let actionG = UIAlertAction(title: "change background color to Green", style: .default) { action in
self.view.backgroundColor = .green
}
let actionB = UIAlertAction(title: "change background color to Blue", style: .default) { action in
self.view.backgroundColor = .blue
}
let cancelAction = UIAlertAction(title: "change background color to White", style: .cancel) { action in
self.view.backgroundColor = .white
}
showActionAlert(
title: "You can add custom alert action",
with: actionR, actionG, actionB, cancelAction
)
showBottomAlert(message: "Bottom Alert Message")
iOS 14.0+ Swift 5+
Uma Kim