mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The Clang attribute allows one to state that a particular enumeration type describes an error, and associates it with a particular domain constant. However, due to lack of API notes support, this attribute wasn't actually getting used. Instead, we had a number of explicit extensions to enum types to make them conform to the _BridgedNSError protocol explicitly. Now that we have API notes, use them to make these enums into error enums with the appropriate domain, so that the Clang importer will synthesize the _BridgedNSError conformances. Then, remove all of the explicit conformances---and with them, the overlays for 12 frameworks. There is a small fix to more eagerly consider these conformances as "used" if an expression is formed with the error enum as a value type. This better ensures that the conformances will be available at runtime when needed. This cleanup is needed to implement SE-0112 (NSError bridging), although it is useful by itself.
55 lines
1.9 KiB
Swift
55 lines
1.9 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
@_exported import WatchKit
|
|
import Foundation
|
|
|
|
@available(iOS, introduced: 8.2)
|
|
extension WKInterfaceController {
|
|
@available(*, unavailable,
|
|
renamed: "reloadRootControllers(withNamesAndContexts:)")
|
|
@nonobjc final public class func reloadRootControllers(
|
|
_ namesAndContexts: [(name: String, context: AnyObject)]
|
|
) {
|
|
reloadRootControllers(withNamesAndContexts: namesAndContexts)
|
|
}
|
|
|
|
// Swift convenience type (class) method for
|
|
// reloadRootControllersWithNames:contexts: that takes an array of tuples
|
|
public class func reloadRootControllers(
|
|
withNamesAndContexts namesAndContexts: [(name: String, context: AnyObject)]
|
|
) {
|
|
WKInterfaceController.reloadRootControllers(
|
|
withNames: namesAndContexts.map { $0.name },
|
|
contexts: namesAndContexts.map { $0.context })
|
|
}
|
|
|
|
@available(*, deprecated,
|
|
renamed: "presentController(withNamesAndContexts:)")
|
|
@nonobjc final public func presentController(
|
|
_ namesAndContexts: [(name: String, context: AnyObject)]
|
|
) {
|
|
presentController(withNamesAndContexts: namesAndContexts)
|
|
}
|
|
|
|
// Swift convenience method for presentControllerWithNames:contexts: that
|
|
// takes an array of tuples
|
|
public func presentController(
|
|
withNamesAndContexts namesAndContexts: [(name: String, context: AnyObject)]
|
|
) {
|
|
self.presentController(
|
|
withNames: namesAndContexts.map { $0.name },
|
|
contexts: namesAndContexts.map { $0.context })
|
|
}
|
|
}
|
|
|