Within the project Swift and OC cross-use

Source: Internet
Author: User
  • Using swift language development in OC projects
  1. Create a swift file while creating a bridging file. (The bridge file does not have to import the header file)
  2. Complete the code in the swift file.
  3. In a. m file of an OC class, use the Swift file. Method #import "OC Project Product name-swift.h" < fixed, do not write >
  4. Once the header file is imported successfully, you can use the Swift class in the OC class

 

  • Using OC language development in Swift projects
  1. Create an OC file while creating a bridging file
  2. Import the header file of the OC class that you need to use in the Swift class in the bridge file, for example: #import "OCTestClass.h"

3. When the above two steps are complete, you can use the OC class directly in the Swift class without the import header file operation

Within the project Swift and OC cross-use

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.