OC calls Swift finishing steps! Summarize other people's! Easy to find yourself!

Source: Internet
Author: User

1.

2.

The above modifies a configuration item that has a product Module name that will be used later.

In the project, click File/new/file ..., select Ios/source/cocoa Touch Class, and create a new file as follows:

Subclass of must be set to NSObject or its subclasses, otherwise OC works will not find the class.

Click on the confirmation will choose to save the path, click Create, the following interface appears:

This interface is asking whether to create a bridged header file, which is useful when Swift calls the OC code, but when I invoke Swift in OC I find that there are no eggs.

3, and then create a "project name"-swift.h file, although this file is useless, but still need to set up a bit. Easy to add this header file in the back of the controller after the addition of this file can be deleted, because the system has built an identical hidden file, you only need to import.


4. Then, you add the SWIFT project you need to the project. Here your project should be able to successfully invoke Swift, you can click "Project name"-swift.h This header file to see if there is content, similar if there is a description you have succeeded. Next you'll want to use the OC syntax as well.

As long as the above steps do not necessarily implement OC invoke Swift. If you have any questions, please correct them! Zpengs

OC calls Swift finishing steps! Summarize other people's! Easy to find yourself!

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.