Documentation Archive Developer
Search

WatchKit Changes for Swift

WatchKit

DeclarationProtocols
From
enum WatchKitErrorCode : Int {
    case UnknownError
    case ApplicationDelegateWatchKitRequestReplyNotCalledError
    case InvalidArgumentError
    case MediaPlayerError
    case DownloadError
    case RecordingFailedError
}
extension WatchKitErrorCode : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
extension WatchKitErrorCode : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
Equatable, ErrorType, Hashable, RawRepresentable
To
enum WatchKitErrorCode : Int {
    case UnknownError
    case ApplicationDelegateWatchKitRequestReplyNotCalledError
    case InvalidArgumentError
    case MediaPlayerError
    case DownloadError
    case RecordingFailedError
}
extension WatchKitErrorCode : _BridgedNSError {
}
extension WatchKitErrorCode : _BridgedNSError {
}
--

Protocols
FromAnyObject
To--

Modified WKAlertAction
Protocols
FromAnyObject
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromAnyObject
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Modified WKExtension
Protocols
FromAnyObject
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Modified WKImage
DeclarationProtocols
From
class WKImage : NSObject, NSCopying, NSSecureCoding, NSCoding {
    convenience init(image image: UIImage)
    class func imageWithImage(_ image: UIImage) -> Self
    convenience init(imageData imageData: NSData)
    class func imageWithImageData(_ imageData: NSData) -> Self
    convenience init(imageName imageName: String)
    class func imageWithImageName(_ imageName: String) -> Self
    init()
    var image: UIImage? { get }
    var imageData: NSData? { get }
    var imageName: String? { get }
}
AnyObject, NSCoding, NSCopying, NSSecureCoding
To
class WKImage : NSObject, NSCopying, NSSecureCoding {
    convenience init(image image: UIImage)
    class func imageWithImage(_ image: UIImage) -> Self
    convenience init(imageData imageData: NSData)
    class func imageWithImageData(_ imageData: NSData) -> Self
    convenience init(imageName imageName: String)
    class func imageWithImageName(_ imageName: String) -> Self
    init()
    var image: UIImage? { get }
    var imageData: NSData? { get }
    var imageName: String? { get }
}
NSCopying, NSSecureCoding

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

DeclarationProtocols
From
class WKInterfaceDevice : NSObject {
    class func currentDevice() -> WKInterfaceDevice
    func addCachedImage(_ image: UIImage, name name: String) -> Bool
    func addCachedImageWithData(_ imageData: NSData, name name: String) -> Bool
    func removeCachedImageWithName(_ name: String)
    func removeAllCachedImages()
    var cachedImages: [String : NSNumber] { get }
    var screenBounds: CGRect { get }
    var screenScale: CGFloat { get }
    var preferredContentSizeCategory: String { get }
    var systemVersion: String { get }
    var name: String { get }
    var model: String { get }
    var localizedModel: String { get }
    var systemName: String { get }
    func playHaptic(_ type: WKHapticType)
}
AnyObject
To
class WKInterfaceDevice : NSObject {
    class func currentDevice() -> WKInterfaceDevice
    func addCachedImage(_ image: UIImage, name name: String) -> Bool
    func addCachedImageWithData(_ imageData: NSData, name name: String) -> Bool
    func removeCachedImageWithName(_ name: String)
    func removeAllCachedImages()
    var cachedImages: [String : NSNumber] { get }
    var screenBounds: CGRect { get }
    var screenScale: CGFloat { get }
    var preferredContentSizeCategory: String { get }
    var layoutDirection: WKInterfaceLayoutDirection { get }
    class func interfaceLayoutDirectionForSemanticContentAttribute(_ semanticContentAttribute: WKInterfaceSemanticContentAttribute) -> WKInterfaceLayoutDirection
    var systemVersion: String { get }
    var name: String { get }
    var model: String { get }
    var localizedModel: String { get }
    var systemName: String { get }
    func playHaptic(_ type: WKHapticType)
}
--

Protocols
FromAnyObject, NSObjectProtocol, WKImageAnimatable
ToWKImageAnimatable

Protocols
FromAnyObject, NSObjectProtocol, WKImageAnimatable
ToWKImageAnimatable

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromAnyObject
To--

DeclarationProtocols
From
class WKInterfaceObject : NSObject {
    init()
    func setHidden(_ hidden: Bool)
    func setAlpha(_ alpha: CGFloat)
    func setHorizontalAlignment(_ horizontalAlignment: WKInterfaceObjectHorizontalAlignment)
    func setVerticalAlignment(_ verticalAlignment: WKInterfaceObjectVerticalAlignment)
    func setWidth(_ width: CGFloat)
    func setHeight(_ height: CGFloat)
    func setRelativeWidth(_ width: CGFloat, withAdjustment adjustment: CGFloat)
    func setRelativeHeight(_ height: CGFloat, withAdjustment adjustment: CGFloat)
    func sizeToFitWidth()
    func sizeToFitHeight()
    var interfaceProperty: String { get }
}
extension WKInterfaceObject {
    func setAccessibilityIdentifier(_ accessibilityIdentifier: String?)
    func setAccessibilityLabel(_ accessibilityLabel: String?)
    func setAccessibilityHint(_ accessibilityHint: String?)
    func setAccessibilityValue(_ accessibilityValue: String?)
    func setIsAccessibilityElement(_ isAccessibilityElement: Bool)
    func setAccessibilityTraits(_ accessibilityTraits: UIAccessibilityTraits)
    func setAccessibilityImageRegions(_ accessibilityImageRegions: [WKAccessibilityImageRegion])
}
AnyObject
To
class WKInterfaceObject : NSObject {
    init()
    func setHidden(_ hidden: Bool)
    func setAlpha(_ alpha: CGFloat)
    func setSemanticContentAttribute(_ semanticContentAttribute: WKInterfaceSemanticContentAttribute)
    func setHorizontalAlignment(_ horizontalAlignment: WKInterfaceObjectHorizontalAlignment)
    func setVerticalAlignment(_ verticalAlignment: WKInterfaceObjectVerticalAlignment)
    func setWidth(_ width: CGFloat)
    func setHeight(_ height: CGFloat)
    func setRelativeWidth(_ width: CGFloat, withAdjustment adjustment: CGFloat)
    func setRelativeHeight(_ height: CGFloat, withAdjustment adjustment: CGFloat)
    func sizeToFitWidth()
    func sizeToFitHeight()
    var interfaceProperty: String { get }
}
extension WKInterfaceObject {
    func setAccessibilityIdentifier(_ accessibilityIdentifier: String?)
    func setAccessibilityLabel(_ accessibilityLabel: String?)
    func setAccessibilityHint(_ accessibilityHint: String?)
    func setAccessibilityValue(_ accessibilityValue: String?)
    func setIsAccessibilityElement(_ isAccessibilityElement: Bool)
    func setAccessibilityTraits(_ accessibilityTraits: UIAccessibilityTraits)
    func setAccessibilityImageRegions(_ accessibilityImageRegions: [WKAccessibilityImageRegion])
}
--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromAnyObject
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Modified WKPickerItem
DeclarationProtocols
From
class WKPickerItem : NSObject, NSSecureCoding, NSCoding {
    var title: String?
    var caption: String?
    @NSCopying var accessoryImage: WKImage?
    @NSCopying var contentImage: WKImage?
}
AnyObject, NSCoding, NSSecureCoding
To
class WKPickerItem : NSObject, NSSecureCoding {
    var title: String?
    var caption: String?
    @NSCopying var accessoryImage: WKImage?
    @NSCopying var contentImage: WKImage?
}
NSSecureCoding

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromAnyObject
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--

Protocols
FromEquatable, Hashable, RawRepresentable
To--