Basic Setup
Swift is designed to provide seamless compatibility with Cocoa and
Objective-C. You can use Objective-C APIs (ranging from system
frameworks to your own custom code) in Swift, and you can use Swift
APIs in Objective-C. This compatibility makes Swift an easy,
convenient, and powerful tool to integrate into your Cocoa app
development workflow.
This guide covers three important aspects of this compatibility that
you can use to your advantage when developing Cocoa apps:
Before you get started learning about these features, you need a
Interoperability lets you interface between Swift and
Objective-C code, allowing you to use Swift classes in
Objective-C and to take advantage of familiar Cocoa
classes, patterns, and practices when writing Swift code.
Mix and match allows you to create mixed-language apps
containing both Swift and Objective-C files that can
communicate with each other.
Migration from existing Objective-C code to Swift is made
easy with interoperability and mix and match, making it
possible to replace parts of your Objective-C apps with the
latest Swift features.
评论1