Drag and drop MSAction.swift and Assets into your project
Empty MSAlert object
MSAlert(viewController: self, sourceView: sender)
Or with title and message
MSAlert(viewController: self, sourceView: sender, title: "Your Title", message: "Your message")
Simple alert action from MSActionType enum
.add(.ok)
Custom alert action title
.add(.cancel, title: "custom title")
Custom alert action style
.add(.cancel, title: "custom title", style: .destructive)
Custom alert action image
.add(.cancel, title: "custom title", style: .destructive, image: my_image)
Use the default image of MSActionType enum
.add(.cancel, title: "custom title", style: .destructive, defaultImage : true)
.add(title: "Accept"){
// completion on click
}
customized:
.add(title: "Accept", isDestructive: false, image: my_image){
// completion on click
}
.setSound(from: myURL)
.setTint(color: .purple)
.show()
.show { didPress in
// on click of alert action
if didPress == .ok{
// do some
}
}
MSAlert is available under the MIT license. See the LICENSE file for more info.