Swift UIColor extensions

extension UIColor {
    convenience init?(rgb: Int) {
        self.init(
            red:    CGFloat((rgb & 0xFF0000) >> 16) / 255.0,
            green:  CGFloat((rgb & 0xFF00) >> 8) / 255.0,
            blue:   CGFloat(rgb & 0xFF) / 255.0,
            alpha:  1.0)
    }

    convenience init?(rgba: Int) {
        self.init(
            red:    CGFloat((rgba & 0xFF000000) >> 32) / 255.0,
            green:  CGFloat((rgba & 0xFF0000) >> 16) / 255.0,
            blue:   CGFloat((rgba & 0xFF00) >> 8) / 255.0,
            alpha:  CGFloat(rgba & 0xFF) / 255.0)
    }
}

Usage

var color1 = UIColor(rgba: 0x435363FF)
var color2 = UIColor(rgb: 0x435363)