Swift Unwrapped
Swift Unwrapped
JP Simard, Jesse Squires, Spec Network, Inc.
05: Objective-C Interoperability
40 minutes Posted Apr 3, 2017 at 5:00 am.
0:00
40:47
Download MP3
Show notes

There's been a much stronger focus on calling ObjC from Swift than the other way around, but in this talk we'll cover both directions and the parts of the Swift language involved in the process.

ObjC Interop Overview

  • Nikita Lutsenko's talk: https://realm.io/news/altconf-nikita-lutsenko-objc-swift-interoperability/
    • NS_SWIFT_NAME
    • NS_SWIFT_UNAVAILABLE
    • NS_REFINED_FOR_SWIFT
    • NS_SWIFT_NOTHROW
    • NS_NOESCAPE
    • NSEXTENSIBLESTRING_ENUM
    • Nullability Annotations
    • Generic Annotations
  • ClangImporter (omit needless words logic lives here)
  • PrintAsObjC
    • Kevin Ballard's PR to include unavailable/deprecated/availability attributes: https://github.com/apple/swift/pull/6480
    • ObjC codegen via string manipulation. Very hackable.

Proposals on ObjC Interop

  • Referencing ObjC key-paths: https://github.com/apple/swift-evolution/blob/master/proposals/0062-objc-keypaths.md
  • Referencing ObjC property selectors: https://github.com/apple/swift-evolution/blob/master/proposals/0064-property-selectors.md
  • Referencing ObjC selector of a method: https://github.com/apple/swift-evolution/blob/master/proposals/0022-objc-selectors.md
  • Great API transformation: https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md
  • Import ObjC constants: https://github.com/apple/swift-evolution/blob/master/proposals/0033-import-objc-constants.md
  • Make optional requirements ObjC only: https://github.com/apple/swift-evolution/blob/master/proposals/0070-optional-requirements.md