Find file History
Permalink
..
Failed to load latest commit information.
AVFoundation.apinotes Update master to build with Xcode 8 beta 4, OS X 10.12, iOS 10, tvOS … Aug 2, 2016
AVKit.apinotes [overlay] Fix PictureInPicture method names with apinotes (#3674) Jul 22, 2016
AppKit.apinotes [SDK] Use SwiftPrivate to remove _silgen_name from the AppKit overlay. Oct 15, 2016
AudioToolbox.apinotes Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS … Jun 14, 2016
CMakeLists.txt Merge pull request #4999 from modocache/cmake-in-list Sep 29, 2016
CallKit.apinotes [overlay] Nest CallKit enum types within their associated classes (#4312 Aug 18, 2016
CloudKit.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
Contacts.apinotes [SE-0112] Add typed accessors for various error types and keys. Jul 13, 2016
CoreBluetooth.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
CoreData.apinotes Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS … Jun 14, 2016
CoreGraphics.apinotes [gardening] Fix accidental trailing whitespace. Oct 29, 2016
CoreLocation.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
CoreSpotlight.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
CoreText.apinotes [API notes] CTFontManagerError is not a valid Error at this time. (#4104 Aug 8, 2016
CryptoTokenKit.apinotes [APINotes] Protocols cannot use import-as-member. (#4482) Aug 24, 2016
Dispatch.apinotes [libdispatch-data-fixes] Appending UnsafeBufferPointers to data is un… Jul 20, 2016
EventKit.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
ExternalAccessory.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
Foundation.apinotes [APINotes] Match the SwiftName for NSXMLDTDKind to the headers. (#6901) Jan 24, 2017
GLKit.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
GameKit.apinotes [APINotes] Replace old FactoryAsInit annotation with equivalent Swift… Oct 14, 2016
GameplayKit.apinotes [gardening] Fix accidental trailing whitespace. Oct 29, 2016
HealthKit.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
HomeKit.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
Intents.apinotes Update master to build with Xcode 8.3 beta 1, OS X 10.12, iOS 10, tvO… Jan 26, 2017
LocalAuthentication.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
MapKit.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
MediaPlayer.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
MessageUI.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
Metal.apinotes [APINotes] Fix mis-annotated error code enums. Sep 28, 2016
MultipeerConnectivity.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
NetworkExtension.apinotes [APINotes] Fix mis-annotated error code enums. Sep 28, 2016
NotificationCenter.apinotes [APINotes] Replace old FactoryAsInit annotation with equivalent Swift… Oct 14, 2016
ObjectiveC.apinotes Recommend type(of:) instead of .dynamicType Sep 26, 2016
PassKit.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
Photos.apinotes Photos overlay (#3613) Jul 20, 2016
QuickLook.apinotes Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS … Jun 14, 2016
README.md [gardening] Fix accidental trailing whitespace. Oct 29, 2016
SafariServices.apinotes [APINotes] Fix mis-annotated error code enums. Sep 28, 2016
SceneKit.apinotes [SceneKit] un-qualify nested type swift_name Aug 10, 2016
SpriteKit.apinotes [apinotes] Remove information that has been migrated into the SDKs. Jun 5, 2015
StoreKit.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
TVMLKit.apinotes Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS … Jun 14, 2016
TVServices.apinotes Add API notes for frameworks following internal audit of Swift 3 API. Apr 5, 2016
UIKit.apinotes [APINotes] Replace old FactoryAsInit annotation with equivalent Swift… Oct 14, 2016
UserNotifications.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
VideoSubscriberAccount.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
WatchConnectivity.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
WatchKit.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
WebKit.apinotes [API Notes] Use API notes rather than overlays to make error enums br… Jul 6, 2016
XCTest.apinotes <rdar://problem/26611147> Swift names for expectation APIs don't matc… Jun 28, 2016
XPC.apinotes Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS … Jun 14, 2016
iAd.apinotes [SE-0112] Associate various error-code enums with their error domains… Jul 13, 2016
os.apinotes Update master to build with Xcode 8 beta 4, OS X 10.12, iOS 10, tvOS … Aug 2, 2016

README.md

API Notes README

API notes provide a mechanism by which Objective-C APIs can be annotated with additional semantic information not present within the original Objective-C headers. This semantic information can then be used by the Swift compiler when importing the corresponding Objective-C module to provide a better mapping of Objective-C APIs into Swift.

API notes are organized into a set of .apinotes files. Each .apinotes file contains annotations for a single Objective-C module, written in YAML (FIXME: to be) described below. These YAML sources must be manually compiled into a binary representation (.apinotesc) that the Swift compiler will lazily load when it builds code, also described below.

API Notes YAML Format

TBD...

Compiling API notes

The Swift compiler lazily loads API notes from compiled API notes files (.apinotesc files) and uses these annotations to affect the Swift signatures of imported Objective-C APIs. Compiled API notes files reside in the Swift module directory, i.e., the same directory where the .swiftmodule file would reside for the Swift overlay of that module. For system modules, the path depends on the platform and architecture.

Platform Path
OSX $SWIFT_EXEC/lib/swift/macosx/
iOS (32-bit) $SWIFT_EXEC/lib/swift/iphoneos/32
iOS (64-bit) $SWIFT_EXEC/lib/swift/iphoneos
iOS Simulator (32-bit) $SWIFT_EXEC/lib/swift/iphonesimulator/32
iOS Simulator (64-bit) $SWIFT_EXEC/lib/swift/iphonesimulator

where $SWIFT_EXEC/bin/swift is the path to the Swift compiler executable.

When updating API notes for a system module, recompile the API notes and place the result in the appropriate directories listed above. The Swift compiler itself need not be recompiled except in rare cases where the changes affect how the SDK overlays are built. To recompile API notes for a given module $MODULE and place them into their

OS X

xcrun swift -apinotes -yaml-to-binary -target x86_64-apple-macosx10.10 -o $SWIFT_EXEC/lib/swift/macosx/$MODULE.apinotesc $MODULE.apinotes

iOS (32-bit)

xcrun swift -apinotes -yaml-to-binary -target armv7-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/32/$MODULE.apinotesc $MODULE.apinotes

iOS (64-bit)

xcrun swift -apinotes -yaml-to-binary -target arm64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/$MODULE.apinotesc $MODULE.apinotes

iOS Simulator (32-bit)

xcrun swift -apinotes -yaml-to-binary -target i386-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/32/$MODULE.apinotesc $MODULE.apinotes

iOS Simulator (64-bit)

xcrun swift -apinotes -yaml-to-binary -target x64_64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/$MODULE.apinotesc $MODULE.apinotes

To add API notes for a system module $MODULE that does not have them yet, create a new source file $MODULE.apinotes and update CMakeLists.txt. Updated API notes will be found by the build system during the next build.

Note that Swift provides decompilation of binary API notes files via the -apinotes -binary-to-yaml option, which allows one to inspect the information the compiler is using internally. The order of the entities in the original YAML input is not preserved, so all entities in the resulting YAML output are sorted alphabetically.