Documentation Archive Developer
Search

UIKit Changes for Swift

UIKit

Modified UIColor
Declaration
From
class UIColor : NSObject, NSSecureCoding, NSCopying {
     init(white white: CGFloat, alpha alpha: CGFloat)
    class func colorWithWhite(_ white: CGFloat, alpha alpha: CGFloat) -> UIColor
     init(hue hue: CGFloat, saturation saturation: CGFloat, brightness brightness: CGFloat, alpha alpha: CGFloat)
    class func colorWithHue(_ hue: CGFloat, saturation saturation: CGFloat, brightness brightness: CGFloat, alpha alpha: CGFloat) -> UIColor
     init(red red: CGFloat, green green: CGFloat, blue blue: CGFloat, alpha alpha: CGFloat)
    class func colorWithRed(_ red: CGFloat, green green: CGFloat, blue blue: CGFloat, alpha alpha: CGFloat) -> UIColor
     init(CGColor cgColor: CGColor)
    class func colorWithCGColor(_ cgColor: CGColor) -> UIColor
     init(patternImage image: UIImage)
    class func colorWithPatternImage(_ image: UIImage) -> UIColor
     init(CIColor ciColor: CIColor)
    class func colorWithCIColor(_ ciColor: CIColor) -> UIColor
    init(white white: CGFloat, alpha alpha: CGFloat)
    init(hue hue: CGFloat, saturation saturation: CGFloat, brightness brightness: CGFloat, alpha alpha: CGFloat)
    init(red red: CGFloat, green green: CGFloat, blue blue: CGFloat, alpha alpha: CGFloat)
    init(CGColor cgColor: CGColor)
    init(patternImage image: UIImage)
    init(CIColor ciColor: CIColor)
    class func blackColor() -> UIColor
    class func darkGrayColor() -> UIColor
    class func lightGrayColor() -> UIColor
    class func whiteColor() -> UIColor
    class func grayColor() -> UIColor
    class func redColor() -> UIColor
    class func greenColor() -> UIColor
    class func blueColor() -> UIColor
    class func cyanColor() -> UIColor
    class func yellowColor() -> UIColor
    class func magentaColor() -> UIColor
    class func orangeColor() -> UIColor
    class func purpleColor() -> UIColor
    class func brownColor() -> UIColor
    class func clearColor() -> UIColor
    func set()
    func setFill()
    func setStroke()
    func getWhite(_ white: UnsafeMutablePointer<CGFloat>, alpha alpha: UnsafeMutablePointer<CGFloat>) -> Bool
    func getHue(_ hue: UnsafeMutablePointer<CGFloat>, saturation saturation: UnsafeMutablePointer<CGFloat>, brightness brightness: UnsafeMutablePointer<CGFloat>, alpha alpha: UnsafeMutablePointer<CGFloat>) -> Bool
    func getRed(_ red: UnsafeMutablePointer<CGFloat>, green green: UnsafeMutablePointer<CGFloat>, blue blue: UnsafeMutablePointer<CGFloat>, alpha alpha: UnsafeMutablePointer<CGFloat>) -> Bool
    func colorWithAlphaComponent(_ alpha: CGFloat) -> UIColor
    var CGColor: CGColor { get }
    var CIColor: CIColor { get }
}
extension UIColor : _ColorLiteralConvertible {
    required convenience init(colorLiteralRed red: Float, green green: Float, blue blue: Float, alpha alpha: Float)
}
extension UIColor {
    class func lightTextColor() -> UIColor
    class func darkTextColor() -> UIColor
    class func groupTableViewBackgroundColor() -> UIColor
    class func viewFlipsideBackgroundColor() -> UIColor
    class func scrollViewTexturedBackgroundColor() -> UIColor
    class func underPageBackgroundColor() -> UIColor
}
extension UIColor : _ColorLiteralConvertible {
    required convenience init(colorLiteralRed red: Float, green green: Float, blue blue: Float, alpha alpha: Float)
}
To
class UIColor : NSObject, NSSecureCoding, NSCopying {
     init(white white: CGFloat, alpha alpha: CGFloat)
    class func colorWithWhite(_ white: CGFloat, alpha alpha: CGFloat) -> UIColor
     init(hue hue: CGFloat, saturation saturation: CGFloat, brightness brightness: CGFloat, alpha alpha: CGFloat)
    class func colorWithHue(_ hue: CGFloat, saturation saturation: CGFloat, brightness brightness: CGFloat, alpha alpha: CGFloat) -> UIColor
     init(red red: CGFloat, green green: CGFloat, blue blue: CGFloat, alpha alpha: CGFloat)
    class func colorWithRed(_ red: CGFloat, green green: CGFloat, blue blue: CGFloat, alpha alpha: CGFloat) -> UIColor
     init(CGColor cgColor: CGColor)
    class func colorWithCGColor(_ cgColor: CGColor) -> UIColor
     init(patternImage image: UIImage)
    class func colorWithPatternImage(_ image: UIImage) -> UIColor
     init(CIColor ciColor: CIColor)
    class func colorWithCIColor(_ ciColor: CIColor) -> UIColor
    init(white white: CGFloat, alpha alpha: CGFloat)
    init(hue hue: CGFloat, saturation saturation: CGFloat, brightness brightness: CGFloat, alpha alpha: CGFloat)
    init(red red: CGFloat, green green: CGFloat, blue blue: CGFloat, alpha alpha: CGFloat)
    init(CGColor cgColor: CGColor)
    init(patternImage image: UIImage)
    init(CIColor ciColor: CIColor)
    class func blackColor() -> UIColor
    class func darkGrayColor() -> UIColor
    class func lightGrayColor() -> UIColor
    class func whiteColor() -> UIColor
    class func grayColor() -> UIColor
    class func redColor() -> UIColor
    class func greenColor() -> UIColor
    class func blueColor() -> UIColor
    class func cyanColor() -> UIColor
    class func yellowColor() -> UIColor
    class func magentaColor() -> UIColor
    class func orangeColor() -> UIColor
    class func purpleColor() -> UIColor
    class func brownColor() -> UIColor
    class func clearColor() -> UIColor
    func set()
    func setFill()
    func setStroke()
    func getWhite(_ white: UnsafeMutablePointer<CGFloat>, alpha alpha: UnsafeMutablePointer<CGFloat>) -> Bool
    func getHue(_ hue: UnsafeMutablePointer<CGFloat>, saturation saturation: UnsafeMutablePointer<CGFloat>, brightness brightness: UnsafeMutablePointer<CGFloat>, alpha alpha: UnsafeMutablePointer<CGFloat>) -> Bool
    func getRed(_ red: UnsafeMutablePointer<CGFloat>, green green: UnsafeMutablePointer<CGFloat>, blue blue: UnsafeMutablePointer<CGFloat>, alpha alpha: UnsafeMutablePointer<CGFloat>) -> Bool
    func colorWithAlphaComponent(_ alpha: CGFloat) -> UIColor
    var CGColor: CGColor { get }
    var CIColor: CIColor { get }
}
extension UIColor {
    required convenience init(colorLiteralRed red: Float, green green: Float, blue blue: Float, alpha alpha: Float)
}
extension UIColor {
    class func lightTextColor() -> UIColor
    class func darkTextColor() -> UIColor
    class func groupTableViewBackgroundColor() -> UIColor
    class func viewFlipsideBackgroundColor() -> UIColor
    class func scrollViewTexturedBackgroundColor() -> UIColor
    class func underPageBackgroundColor() -> UIColor
}
extension UIColor {
    required convenience init(colorLiteralRed red: Float, green green: Float, blue blue: Float, alpha alpha: Float)
}

Declaration
From
class UIGestureRecognizer : NSObject {
    init(target target: AnyObject?, action action: Selector)
    func addTarget(_ target: AnyObject, action action: Selector)
    func removeTarget(_ target: AnyObject?, action action: Selector)
    var state: UIGestureRecognizerState { get }
    weak var delegate: UIGestureRecognizerDelegate?
    var enabled: Bool
    var view: UIView? { get }
    var cancelsTouchesInView: Bool
    var delaysTouchesBegan: Bool
    var delaysTouchesEnded: Bool
    var allowedTouchTypes: [NSNumber]
    var allowedPressTypes: [NSNumber]
    func requireGestureRecognizerToFail(_ otherGestureRecognizer: UIGestureRecognizer)
    func locationInView(_ view: UIView?) -> CGPoint
    func numberOfTouches() -> Int
    func locationOfTouch(_ touchIndex: Int, inView view: UIView?) -> CGPoint
}
To
class UIGestureRecognizer : NSObject {
    init(target target: AnyObject?, action action: Selector)
    func addTarget(_ target: AnyObject, action action: Selector)
    func removeTarget(_ target: AnyObject?, action action: Selector)
    weak var delegate: UIGestureRecognizerDelegate?
    var enabled: Bool
    var view: UIView? { get }
    var cancelsTouchesInView: Bool
    var delaysTouchesBegan: Bool
    var delaysTouchesEnded: Bool
    var allowedTouchTypes: [NSNumber]
    var allowedPressTypes: [NSNumber]
    func requireGestureRecognizerToFail(_ otherGestureRecognizer: UIGestureRecognizer)
    func locationInView(_ view: UIView?) -> CGPoint
    func numberOfTouches() -> Int
    func locationOfTouch(_ touchIndex: Int, inView view: UIView?) -> CGPoint
}
extension UIGestureRecognizer {
    var state: UIGestureRecognizerState
    func ignoreTouch(_ touch: UITouch, forEvent event: UIEvent)
    func ignorePress(_ button: UIPress, forEvent event: UIPressesEvent)
    func reset()
    func canPreventGestureRecognizer(_ preventedGestureRecognizer: UIGestureRecognizer) -> Bool
    func canBePreventedByGestureRecognizer(_ preventingGestureRecognizer: UIGestureRecognizer) -> Bool
    func shouldRequireFailureOfGestureRecognizer(_ otherGestureRecognizer: UIGestureRecognizer) -> Bool
    func shouldBeRequiredToFailByGestureRecognizer(_ otherGestureRecognizer: UIGestureRecognizer) -> Bool
    func touchesBegan(_ touches: Set<UITouch>, withEvent event: UIEvent)
    func touchesMoved(_ touches: Set<UITouch>, withEvent event: UIEvent)
    func touchesEnded(_ touches: Set<UITouch>, withEvent event: UIEvent)
    func touchesCancelled(_ touches: Set<UITouch>, withEvent event: UIEvent)
    func touchesEstimatedPropertiesUpdated(_ touches: Set<NSObject>)
    func pressesBegan(_ presses: Set<UIPress>, withEvent event: UIPressesEvent)
    func pressesChanged(_ presses: Set<UIPress>, withEvent event: UIPressesEvent)
    func pressesEnded(_ presses: Set<UIPress>, withEvent event: UIPressesEvent)
    func pressesCancelled(_ presses: Set<UIPress>, withEvent event: UIPressesEvent)
}

DeclarationReadonly
From
var state: UIGestureRecognizerState { get }
yes
To
var state: UIGestureRecognizerState
--

Modified UIImage
Declaration
From
class UIImage : NSObject, NSSecureCoding {
     init?(named name: String)
    class func imageNamed(_ name: String) -> UIImage?
     init?(named name: String, inBundle bundle: NSBundle?, compatibleWithTraitCollection traitCollection: UITraitCollection?)
    class func imageNamed(_ name: String, inBundle bundle: NSBundle?, compatibleWithTraitCollection traitCollection: UITraitCollection?) -> UIImage?
     init?(contentsOfFile path: String)
    class func imageWithContentsOfFile(_ path: String) -> UIImage?
     init?(data data: NSData)
    class func imageWithData(_ data: NSData) -> UIImage?
     init?(data data: NSData, scale scale: CGFloat)
    class func imageWithData(_ data: NSData, scale scale: CGFloat) -> UIImage?
     init(CGImage cgImage: CGImage)
    class func imageWithCGImage(_ cgImage: CGImage) -> UIImage
     init(CGImage cgImage: CGImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    class func imageWithCGImage(_ cgImage: CGImage, scale scale: CGFloat, orientation orientation: UIImageOrientation) -> UIImage
     init(CIImage ciImage: CIImage)
    class func imageWithCIImage(_ ciImage: CIImage) -> UIImage
     init(CIImage ciImage: CIImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    class func imageWithCIImage(_ ciImage: CIImage, scale scale: CGFloat, orientation orientation: UIImageOrientation) -> UIImage
    init?(contentsOfFile path: String)
    init?(data data: NSData)
    init?(data data: NSData, scale scale: CGFloat)
    init(CGImage cgImage: CGImage)
    init(CGImage cgImage: CGImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    init(CIImage ciImage: CIImage)
    init(CIImage ciImage: CIImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    var size: CGSize { get }
    var CGImage: CGImage? { get }
    var CIImage: CIImage? { get }
    var imageOrientation: UIImageOrientation { get }
    var scale: CGFloat { get }
    class func animatedImageNamed(_ name: String, duration duration: NSTimeInterval) -> UIImage?
    class func animatedResizableImageNamed(_ name: String, capInsets capInsets: UIEdgeInsets, duration duration: NSTimeInterval) -> UIImage?
    class func animatedResizableImageNamed(_ name: String, capInsets capInsets: UIEdgeInsets, resizingMode resizingMode: UIImageResizingMode, duration duration: NSTimeInterval) -> UIImage?
    class func animatedImageWithImages(_ images: [UIImage], duration duration: NSTimeInterval) -> UIImage?
    var images: [UIImage]? { get }
    var duration: NSTimeInterval { get }
    func drawAtPoint(_ point: CGPoint)
    func drawAtPoint(_ point: CGPoint, blendMode blendMode: CGBlendMode, alpha alpha: CGFloat)
    func drawInRect(_ rect: CGRect)
    func drawInRect(_ rect: CGRect, blendMode blendMode: CGBlendMode, alpha alpha: CGFloat)
    func drawAsPatternInRect(_ rect: CGRect)
    func resizableImageWithCapInsets(_ capInsets: UIEdgeInsets) -> UIImage
    func resizableImageWithCapInsets(_ capInsets: UIEdgeInsets, resizingMode resizingMode: UIImageResizingMode) -> UIImage
    var capInsets: UIEdgeInsets { get }
    var resizingMode: UIImageResizingMode { get }
    func imageWithAlignmentRectInsets(_ alignmentInsets: UIEdgeInsets) -> UIImage
    var alignmentRectInsets: UIEdgeInsets { get }
    func imageWithRenderingMode(_ renderingMode: UIImageRenderingMode) -> UIImage
    var renderingMode: UIImageRenderingMode { get }
    @NSCopying var traitCollection: UITraitCollection { get }
    var imageAsset: UIImageAsset? { get }
    func imageFlippedForRightToLeftLayoutDirection() -> UIImage
    var flipsForRightToLeftLayoutDirection: Bool { get }
}
extension UIImage : UIAccessibilityIdentification {
}
extension UIImage : _ImageLiteralConvertible {
    required convenience init(imageLiteral name: String)
}
extension UIImage {
    func stretchableImageWithLeftCapWidth(_ leftCapWidth: Int, topCapHeight topCapHeight: Int) -> UIImage
    var leftCapWidth: Int { get }
    var topCapHeight: Int { get }
}
extension UIImage : _ImageLiteralConvertible {
    required convenience init(imageLiteral name: String)
}
To
class UIImage : NSObject, NSSecureCoding {
     init?(named name: String)
    class func imageNamed(_ name: String) -> UIImage?
     init?(named name: String, inBundle bundle: NSBundle?, compatibleWithTraitCollection traitCollection: UITraitCollection?)
    class func imageNamed(_ name: String, inBundle bundle: NSBundle?, compatibleWithTraitCollection traitCollection: UITraitCollection?) -> UIImage?
     init?(contentsOfFile path: String)
    class func imageWithContentsOfFile(_ path: String) -> UIImage?
     init?(data data: NSData)
    class func imageWithData(_ data: NSData) -> UIImage?
     init?(data data: NSData, scale scale: CGFloat)
    class func imageWithData(_ data: NSData, scale scale: CGFloat) -> UIImage?
     init(CGImage cgImage: CGImage)
    class func imageWithCGImage(_ cgImage: CGImage) -> UIImage
     init(CGImage cgImage: CGImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    class func imageWithCGImage(_ cgImage: CGImage, scale scale: CGFloat, orientation orientation: UIImageOrientation) -> UIImage
     init(CIImage ciImage: CIImage)
    class func imageWithCIImage(_ ciImage: CIImage) -> UIImage
     init(CIImage ciImage: CIImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    class func imageWithCIImage(_ ciImage: CIImage, scale scale: CGFloat, orientation orientation: UIImageOrientation) -> UIImage
    init?(contentsOfFile path: String)
    init?(data data: NSData)
    init?(data data: NSData, scale scale: CGFloat)
    init(CGImage cgImage: CGImage)
    init(CGImage cgImage: CGImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    init(CIImage ciImage: CIImage)
    init(CIImage ciImage: CIImage, scale scale: CGFloat, orientation orientation: UIImageOrientation)
    var size: CGSize { get }
    var CGImage: CGImage? { get }
    var CIImage: CIImage? { get }
    var imageOrientation: UIImageOrientation { get }
    var scale: CGFloat { get }
    class func animatedImageNamed(_ name: String, duration duration: NSTimeInterval) -> UIImage?
    class func animatedResizableImageNamed(_ name: String, capInsets capInsets: UIEdgeInsets, duration duration: NSTimeInterval) -> UIImage?
    class func animatedResizableImageNamed(_ name: String, capInsets capInsets: UIEdgeInsets, resizingMode resizingMode: UIImageResizingMode, duration duration: NSTimeInterval) -> UIImage?
    class func animatedImageWithImages(_ images: [UIImage], duration duration: NSTimeInterval) -> UIImage?
    var images: [UIImage]? { get }
    var duration: NSTimeInterval { get }
    func drawAtPoint(_ point: CGPoint)
    func drawAtPoint(_ point: CGPoint, blendMode blendMode: CGBlendMode, alpha alpha: CGFloat)
    func drawInRect(_ rect: CGRect)
    func drawInRect(_ rect: CGRect, blendMode blendMode: CGBlendMode, alpha alpha: CGFloat)
    func drawAsPatternInRect(_ rect: CGRect)
    func resizableImageWithCapInsets(_ capInsets: UIEdgeInsets) -> UIImage
    func resizableImageWithCapInsets(_ capInsets: UIEdgeInsets, resizingMode resizingMode: UIImageResizingMode) -> UIImage
    var capInsets: UIEdgeInsets { get }
    var resizingMode: UIImageResizingMode { get }
    func imageWithAlignmentRectInsets(_ alignmentInsets: UIEdgeInsets) -> UIImage
    var alignmentRectInsets: UIEdgeInsets { get }
    func imageWithRenderingMode(_ renderingMode: UIImageRenderingMode) -> UIImage
    var renderingMode: UIImageRenderingMode { get }
    @NSCopying var traitCollection: UITraitCollection { get }
    var imageAsset: UIImageAsset? { get }
    func imageFlippedForRightToLeftLayoutDirection() -> UIImage
    var flipsForRightToLeftLayoutDirection: Bool { get }
}
extension UIImage : UIAccessibilityIdentification {
}
extension UIImage {
    required convenience init(imageLiteral name: String)
}
extension UIImage {
    func stretchableImageWithLeftCapWidth(_ leftCapWidth: Int, topCapHeight topCapHeight: Int) -> UIImage
    var leftCapWidth: Int { get }
    var topCapHeight: Int { get }
}
extension UIImage {
    required convenience init(imageLiteral name: String)
}

Declaration
From
enum UIUserInterfaceIdiom : Int {
    case Unspecified
    case Phone
    case Pad
    case TV
}
To
enum UIUserInterfaceIdiom : Int {
    case Unspecified
    case Phone
    case Pad
    case TV
    case CarPlay
}