Go to swfit (3) Swift to call OC and swfitswift to call oc

Source: Internet
Author: User

Go to swfit (3) Swift to call OC and swfitswift to call oc

To call a custom OC class or open source package in Swift, you just need to do the bridge, create a file named project name-Bridging-Header.h file ,. the H file can import the file you want like in OC, and then the Objective-C Bridging Header in Build Settings, where the value is, enter the header file you created.

1. You can drag the corresponding header file to the input box of the filled value.

2. manually enter the header file path to the input box, such as: JokerMost/Swift-ObjectiveC-Bridge.h

In fact, # define can also be implemented here.


In Swift development, a subclass of UICollectionViewCell is created: ExhibitionCell. The error "No such module 'cocoa 'is returned:

The reason is simple: when creating a new File, you should select the "OS X" project. In fact, you should select the "iOS" project. Delete the error File and create a new File.

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.