Skip to content

UmaBasicAlertKit allows users to use customizable Apple's default alert with a simple line of code.

Notifications You must be signed in to change notification settings

umaKim/UmaBasicAlertKit

Repository files navigation

UmaBasicAlertKit

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.

Simulator Screen Recording - iPhone 12 Pro - 2021-12-26 at 00 42 25 Simulator Screen Recording - iPhone 12 Pro - 2021-12-26 at 00 43 08 Simulator Screen Recording - iPhone 12 Pro - 2021-12-26 at 00 43 23 Simulator Screen Recording - iPhone 12 Pro - 2021-12-26 at 00 43 37 Simulator Screen Recording - iPhone 12 Pro - 2021-12-26 at 00 43 59 Simulator Screen Recording - iPhone 12 Pro - 2021-12-26 at 00 44 18 Simulator Screen Recording - iPhone 12 Pro - 2021-12-26 at 00 44 53

Installation

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.

Usage

In order to use the methods, Alertable should be implemented by your viewController.

class ViewController: UIViewController, Alertable {

}

showDefaultAlert

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
        }

showActionAlert

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

showBottomAlert(message: "Bottom Alert Message")

Requirements

iOS 14.0+ Swift 5+

Author

Uma Kim

About

UmaBasicAlertKit allows users to use customizable Apple's default alert with a simple line of code.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages