WatchKit Changes for Swift
WatchKit
Removed WKInterfaceGroup.startAnimating()
Removed WKInterfaceGroup.startAnimatingWithImagesInRange(_: NSRange, duration: NSTimeInterval, repeatCount: Int)
Removed WKInterfaceGroup.stopAnimating()
Removed WKInterfaceImage.startAnimating()
Removed WKInterfaceImage.startAnimatingWithImagesInRange(_: NSRange, duration: NSTimeInterval, repeatCount: Int)
Removed WKInterfaceImage.stopAnimating()
Added WKImageAnimatable
Added WKInterfaceController.presentController(_: [(name: String, context: AnyObject)])
Added WKInterfaceController.reloadRootControllers(_: [(name: String, context: AnyObject)]) [class]
Added WKInterfaceDevice.model
Added WKInterfaceDevice.name
Modified WatchKitErrorCode [enum]
| Declaration | Protocols | Raw Value Type | |
|---|---|---|---|
| From | enum WatchKitErrorCode : Int {
case UnknownError
case ApplicationDelegateWatchKitRequestReplyNotCalledError
} | Equatable, Hashable, RawRepresentable | -- |
| To | enum WatchKitErrorCode : Int {
case UnknownError
case ApplicationDelegateWatchKitRequestReplyNotCalledError
case InvalidArgumentError
case MediaPlayerError
case DownloadError
}
extension WatchKitErrorCode : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
extension WatchKitErrorCode : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
} | Equatable, ErrorType, Hashable, RawRepresentable | Int |
Modified WKInterfaceController
| Declaration | |
|---|---|
| From | class WKInterfaceController : NSObject {
init()
func awakeWithContext(_ context: AnyObject?)
var contentFrame: CGRect { get }
func willActivate()
func didDeactivate()
func table(_ table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int)
func handleActionWithIdentifier(_ identifier: String?, forRemoteNotification remoteNotification: [NSObject : AnyObject])
func handleActionWithIdentifier(_ identifier: String?, forLocalNotification localNotification: UILocalNotification)
func handleUserActivity(_ userInfo: [NSObject : AnyObject]?)
func setTitle(_ title: String?)
func pushControllerWithName(_ name: String, context context: AnyObject?)
func popController()
func popToRootController()
class func reloadRootControllersWithNames(_ names: [AnyObject], contexts contexts: [AnyObject]?)
func becomeCurrentPage()
func presentControllerWithName(_ name: String, context context: AnyObject?)
func presentControllerWithNames(_ names: [AnyObject], contexts contexts: [AnyObject]?)
func dismissController()
func presentTextInputControllerWithSuggestions(_ suggestions: [AnyObject]?, allowedInputMode inputMode: WKTextInputMode, completion completion: ([AnyObject]!) -> Void)
func dismissTextInputController()
func contextForSegueWithIdentifier(_ segueIdentifier: String) -> AnyObject?
func contextsForSegueWithIdentifier(_ segueIdentifier: String) -> [AnyObject]?
func contextForSegueWithIdentifier(_ segueIdentifier: String, inTable table: WKInterfaceTable, rowIndex rowIndex: Int) -> AnyObject?
func contextsForSegueWithIdentifier(_ segueIdentifier: String, inTable table: WKInterfaceTable, rowIndex rowIndex: Int) -> [AnyObject]?
func addMenuItemWithImage(_ image: UIImage, title title: String, action action: Selector)
func addMenuItemWithImageNamed(_ imageName: String, title title: String, action action: Selector)
func addMenuItemWithItemIcon(_ itemIcon: WKMenuItemIcon, title title: String, action action: Selector)
func clearAllMenuItems()
func updateUserActivity(_ type: String, userInfo userInfo: [NSObject : AnyObject]?, webpageURL webpageURL: NSURL?)
func invalidateUserActivity()
class func openParentApplication(_ userInfo: [NSObject : AnyObject], reply reply: (([NSObject : AnyObject]!, NSError!) -> Void)?) -> Bool
} |
| To | class WKInterfaceController : NSObject {
init()
func awakeWithContext(_ context: AnyObject?)
var contentFrame: CGRect { get }
func willActivate()
func didDeactivate()
func didAppear()
func willDisappear()
func pickerDidFocus(_ picker: WKInterfacePicker)
func pickerDidResignFocus(_ picker: WKInterfacePicker)
func pickerDidSettle(_ picker: WKInterfacePicker)
func table(_ table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int)
func handleActionWithIdentifier(_ identifier: String?, forRemoteNotification remoteNotification: [NSObject : AnyObject])
func handleActionWithIdentifier(_ identifier: String?, forLocalNotification localNotification: UILocalNotification)
func handleUserActivity(_ userInfo: [NSObject : AnyObject]?)
func setTitle(_ title: String?)
func pushControllerWithName(_ name: String, context context: AnyObject?)
func popController()
func popToRootController()
class func reloadRootControllersWithNames(_ names: [String], contexts contexts: [AnyObject]?)
func becomeCurrentPage()
func presentControllerWithName(_ name: String, context context: AnyObject?)
func presentControllerWithNames(_ names: [String], contexts contexts: [AnyObject]?)
func dismissController()
func presentTextInputControllerWithSuggestions(_ suggestions: [String]?, allowedInputMode inputMode: WKTextInputMode, completion completion: ([AnyObject]?) -> Void)
func presentTextInputControllerWithSuggestionsForLanguage(_ suggestionsHandler: ((String) -> [AnyObject]?)?, allowedInputMode inputMode: WKTextInputMode, completion completion: ([AnyObject]?) -> Void)
func dismissTextInputController()
func presentMediaPlayerControllerWithURL(_ URL: NSURL, options options: [NSObject : AnyObject]?, completion completion: (Bool, NSTimeInterval, NSError?) -> Void)
func dismissMediaPlayerController()
func presentAudioRecordingControllerWithOutputURL(_ URL: NSURL, preset preset: WKAudioRecordingPreset, maximumDuration maximumDuration: NSTimeInterval, actionTitle actionTitle: String?, completion completion: (Bool, NSError?) -> Void)
func dismissAudioRecordingController()
func contextForSegueWithIdentifier(_ segueIdentifier: String) -> AnyObject?
func contextsForSegueWithIdentifier(_ segueIdentifier: String) -> [AnyObject]?
func contextForSegueWithIdentifier(_ segueIdentifier: String, inTable table: WKInterfaceTable, rowIndex rowIndex: Int) -> AnyObject?
func contextsForSegueWithIdentifier(_ segueIdentifier: String, inTable table: WKInterfaceTable, rowIndex rowIndex: Int) -> [AnyObject]?
func animateWithDuration(_ duration: NSTimeInterval, animations animations: () -> Void)
func presentAlertControllerWithTitle(_ title: String?, message message: String?, preferredStyle preferredStyle: WKAlertControllerStyle, actions actions: [WKAlertAction])
func presentAddPassesControllerWithPasses(_ passes: [PKPass], completion completion: () -> Void)
func dismissAddPassesController()
func addMenuItemWithImage(_ image: UIImage, title title: String, action action: Selector)
func addMenuItemWithImageNamed(_ imageName: String, title title: String, action action: Selector)
func addMenuItemWithItemIcon(_ itemIcon: WKMenuItemIcon, title title: String, action action: Selector)
func clearAllMenuItems()
func updateUserActivity(_ type: String, userInfo userInfo: [NSObject : AnyObject]?, webpageURL webpageURL: NSURL?)
func invalidateUserActivity()
class func openParentApplication(_ userInfo: [NSObject : AnyObject], reply reply: (([NSObject : AnyObject], NSError?) -> Void)?) -> Bool
func beginGlanceUpdates()
func endGlanceUpdates()
}
extension WKInterfaceController {
class func reloadRootControllers(_ namesAndContexts: [(name: String, context: AnyObject)])
func presentController(_ namesAndContexts: [(name: String, context: AnyObject)])
}
extension WKInterfaceController {
class func reloadRootControllers(_ namesAndContexts: [(name: String, context: AnyObject)])
func presentController(_ namesAndContexts: [(name: String, context: AnyObject)])
} |
| Declaration | |
|---|---|
| From | class func openParentApplication(_ userInfo: [NSObject : AnyObject], reply reply: (([NSObject : AnyObject]!, NSError!) -> Void)?) -> Bool |
| To | class func openParentApplication(_ userInfo: [NSObject : AnyObject], reply reply: (([NSObject : AnyObject], NSError?) -> Void)?) -> Bool |
| Declaration | |
|---|---|
| From | func presentControllerWithNames(_ names: [AnyObject], contexts contexts: [AnyObject]?) |
| To | func presentControllerWithNames(_ names: [String], contexts contexts: [AnyObject]?) |
| Declaration | |
|---|---|
| From | func presentTextInputControllerWithSuggestions(_ suggestions: [AnyObject]?, allowedInputMode inputMode: WKTextInputMode, completion completion: ([AnyObject]!) -> Void) |
| To | func presentTextInputControllerWithSuggestions(_ suggestions: [String]?, allowedInputMode inputMode: WKTextInputMode, completion completion: ([AnyObject]?) -> Void) |
Modified WKInterfaceController.reloadRootControllersWithNames(_: [String], contexts: [AnyObject]?) [class]
| Declaration | |
|---|---|
| From | class func reloadRootControllersWithNames(_ names: [AnyObject], contexts contexts: [AnyObject]?) |
| To | class func reloadRootControllersWithNames(_ names: [String], contexts contexts: [AnyObject]?) |
Modified WKInterfaceDevice
| Declaration | |
|---|---|
| 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 screenBounds: CGRect { get }
var screenScale: CGFloat { get }
var preferredContentSizeCategory: String { get }
var cachedImages: [NSObject : AnyObject] { get }
} |
| 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 screenBounds: CGRect { get }
var screenScale: CGFloat { get }
var preferredContentSizeCategory: String { get }
var cachedImages: [String : NSNumber] { 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)
} |
Modified WKInterfaceDevice.cachedImages
| Declaration | |
|---|---|
| From | var cachedImages: [NSObject : AnyObject] { get } |
| To | var cachedImages: [String : NSNumber] { get } |
Modified WKInterfaceGroup
| Declaration | Protocols | |
|---|---|---|
| From | class WKInterfaceGroup : WKInterfaceObject {
func setCornerRadius(_ cornerRadius: CGFloat)
func setBackgroundColor(_ color: UIColor?)
func setBackgroundImage(_ image: UIImage?)
func setBackgroundImageData(_ imageData: NSData?)
func setBackgroundImageNamed(_ imageName: String?)
func startAnimating()
func startAnimatingWithImagesInRange(_ imageRange: NSRange, duration duration: NSTimeInterval, repeatCount repeatCount: Int)
func stopAnimating()
} | AnyObject |
| To | class WKInterfaceGroup : WKInterfaceObject, WKImageAnimatable {
func setCornerRadius(_ cornerRadius: CGFloat)
func setContentInset(_ contentInset: UIEdgeInsets)
func setBackgroundColor(_ color: UIColor?)
func setBackgroundImage(_ image: UIImage?)
func setBackgroundImageData(_ imageData: NSData?)
func setBackgroundImageNamed(_ imageName: String?)
} | AnyObject, NSObjectProtocol, WKImageAnimatable |
Modified WKInterfaceImage
| Declaration | Protocols | |
|---|---|---|
| From | class WKInterfaceImage : WKInterfaceObject {
func setImage(_ image: UIImage?)
func setImageData(_ imageData: NSData?)
func setImageNamed(_ imageName: String?)
func setTintColor(_ tintColor: UIColor?)
func startAnimating()
func startAnimatingWithImagesInRange(_ imageRange: NSRange, duration duration: NSTimeInterval, repeatCount repeatCount: Int)
func stopAnimating()
} | AnyObject |
| To | class WKInterfaceImage : WKInterfaceObject, WKImageAnimatable {
func setImage(_ image: UIImage?)
func setImageData(_ imageData: NSData?)
func setImageNamed(_ imageName: String?)
func setTintColor(_ tintColor: UIColor?)
} | AnyObject, NSObjectProtocol, WKImageAnimatable |
Modified WKInterfaceMapPinColor [enum]
| Raw Value Type | |
|---|---|
| From | -- |
| To | Int |
Modified WKInterfaceObject
| Declaration | |
|---|---|
| From | class WKInterfaceObject : NSObject {
init!()
func setHidden(_ hidden: Bool)
func setAlpha(_ alpha: CGFloat)
func setWidth(_ width: CGFloat)
func setHeight(_ height: CGFloat)
var interfaceProperty: String { get }
}
extension WKInterfaceObject {
func setAccessibilityLabel(_ accessibilityLabel: String?)
func setAccessibilityHint(_ accessibilityHint: String?)
func setAccessibilityValue(_ accessibilityValue: String?)
func setIsAccessibilityElement(_ isAccessibilityElement: Bool)
func setAccessibilityTraits(_ accessibilityTraits: UIAccessibilityTraits)
func setAccessibilityImageRegions(_ accessibilityImageRegions: [AnyObject])
} |
| To | 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])
} |
| Declaration | |
|---|---|
| From | func setAccessibilityImageRegions(_ accessibilityImageRegions: [AnyObject]) |
| To | func setAccessibilityImageRegions(_ accessibilityImageRegions: [WKAccessibilityImageRegion]) |
Modified WKInterfaceTable
| Declaration | |
|---|---|
| From | class WKInterfaceTable : WKInterfaceObject {
func setRowTypes(_ rowTypes: [AnyObject])
func setNumberOfRows(_ numberOfRows: Int, withRowType rowType: String)
var numberOfRows: Int { get }
func rowControllerAtIndex(_ index: Int) -> AnyObject?
func insertRowsAtIndexes(_ rows: NSIndexSet, withRowType rowType: String)
func removeRowsAtIndexes(_ rows: NSIndexSet)
func scrollToRowAtIndex(_ index: Int)
} |
| To | class WKInterfaceTable : WKInterfaceObject {
func setRowTypes(_ rowTypes: [String])
func setNumberOfRows(_ numberOfRows: Int, withRowType rowType: String)
var numberOfRows: Int { get }
func rowControllerAtIndex(_ index: Int) -> AnyObject?
func insertRowsAtIndexes(_ rows: NSIndexSet, withRowType rowType: String)
func removeRowsAtIndexes(_ rows: NSIndexSet)
func scrollToRowAtIndex(_ index: Int)
} |
| Declaration | |
|---|---|
| From | func setRowTypes(_ rowTypes: [AnyObject]) |
| To | func setRowTypes(_ rowTypes: [String]) |
Modified WKMenuItemIcon [enum]
| Raw Value Type | |
|---|---|
| From | -- |
| To | Int |
Modified WKTextInputMode [enum]
| Raw Value Type | |
|---|---|
| From | -- |
| To | Int |
| Declaration | |
|---|---|
| From | class WKUserNotificationInterfaceController : WKInterfaceController {
init()
func didReceiveRemoteNotification(_ remoteNotification: [NSObject : AnyObject], withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void)
func didReceiveLocalNotification(_ localNotification: UILocalNotification, withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void)
} |
| To | class WKUserNotificationInterfaceController : WKInterfaceController {
init()
func didReceiveRemoteNotification(_ remoteNotification: [NSObject : AnyObject], withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void)
func didReceiveLocalNotification(_ localNotification: UILocalNotification, withCompletion completionHandler: (WKUserNotificationInterfaceType) -> Void)
func suggestionsForResponseToActionWithIdentifier(_ identifier: String, forRemoteNotification remoteNotification: [NSObject : AnyObject], inputLanguage inputLanguage: String) -> [String]
func suggestionsForResponseToActionWithIdentifier(_ identifier: String, forLocalNotification localNotification: UILocalNotification, inputLanguage inputLanguage: String) -> [String]
} |
| Raw Value Type | |
|---|---|
| From | -- |
| To | Int |