Rewrite the company OC Project with Swift (DAY2)-Create a bridging file for OC and Swift, and call the OC Class Library

Source: Internet
Author: User

Yesterday, the icon in the project and the start of the transition picture is ready, so today, we can start slowly into the process of writing.

Because Swift is newer, so the class library is not perfect, but do not worry, Apple has already had a solution, that is, the use of bridging files, through the bridge file, the system will be the class library of the OC code into the swift language, so that there is no obstacle to use.

So how do you create a bridging file and how to call a class library? See below:

Create an OC. m file so that when you click on the next input file name and then select Store location after create, the system pops up the following options:

See here, of course to choose the latter, our goal is to create this bridge file! When you click Confirm, you can see two more files in the project:

Here, we need the. h file, it's already in our project, then you can delete the. m file you just created, and then you can make reference to the class library in this bridging file ....

Well, this is the creation of the bridge file, and the next time I'll write down in detail how to make a class library reference and Invoke ... and realize the map of Baidu map display and positioning function ...

Rewrite the company OC Project with Swift (DAY2)-Create a bridging file for OC and Swift, and call the OC Class Library

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.