OC and Swift mixed key

Source: Internet
Author: User

1. Bridge Connector File--xx-bridge-header.h

Swift and OC mixed connection points are essential. When you add OC or Swift to a swift engineering or OC Project, Xcode alerts are recommended to be added manually.

Note After you introduce the file, Xcode target->build settings automatically adds the Swift Compiler * entry, Objective-c Bridging header entry to fill out this file path (xx/ Xx-bridge-header.h,xx for Project name)

2. Hide header file--xx-swift.h

Essential. When OC tries Swift, Xcode is created by default, and the bridge header file is created and #import "Xx-swift.h" (xx is the project name) in OC file.

3. Usage

OC using #import "Xx-swift.h" in Swift:oc file

Swift uses OC:OC header files written in Xx-bridge-header.h

OC and Swift mixed key

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.