A lightweight alert framework written in swift
- Simply add
AlertView.swift
into your Xcode project!
To create a new alert:
let newAlert = SimpleAlert(width: 200, height: 300, image: "image", text: "Alert!", textAlignment: "top",
backgroundColor: UIColor.blue, imageWidth: 100, imageHeight: 100, buttonWidth: 200, buttonHeight: 50, buttonAlignment: "bottom")
width
- width of the alertheight
- height of the alertimage
- image displayed in the alert (use""
if no image is used)text
- static text to be displayed in the alert)textAlignment
- where the text will be displayed in the alert ("top", "center", or "bottom"
)backgroundColor
- color of the alert's background (UIColor.xxxx)imageWidth
- width of the imageimageHeight
- height of the imagebuttonWidth
- width of the buttonbuttonHeight
- height of the buttonbuttonAlignment
- where the button will be displayed (`"top", "center", or "bottom")
To add the newly-created alert to the view:
newAlert.center = view.center //this will make it display in the center of the view
self.view.addSubview(newAlert)