Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import UIKit
extension UIAlertController {
func setLeftAlignedMessage(_ message: String) {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .left
let messageText = NSMutableAttributedString(
string: message,
attributes: [
NSParagraphStyleAttributeName: paragraphStyle,
NSFontAttributeName : UIFont.preferredFont(forTextStyle: UIFontTextStyle.body),
NSForegroundColorAttributeName :
setValue(messageText, forKey: "attributedMessage")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.