Swift,objective-c,c,c++ Hybrid Programming

Source: Internet
Author: User

(1) Swift and C language communication

In Xcode, when the C language file is added to the SWIFT project, Xcode asks if the Create bridging Header is selected.

The C language header file is then referenced in the bridging header.

You can then use the C language function in the swift file.

(2) Swift and OBJECTIVE-C communication

Ibid., referencing the Objective-c language header file in the bridging header.

The classes defined in Objective-c can then be used in swift files.

(3) Objective-c and C + +

The swift language cannot execute code in the C + + language.

Objective-c need to change the. m suffix to. MM, then introduce a C + + header file in the mm file, and then use the classes defined in C + +.

Note: C + + header files cannot be introduced in the OBJECTIVE-C header file, only in mm files.

Note: MM files are called objective-c++ files.

Swift,objective-c,c,c++ Hybrid Programming

Related Article

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.