iOS Development--Error summary & common errors and warnings in development summary (10)

Source: Internet
Author: User

Summary of common errors and warnings in development (10)

Common errors:

  • Think of Swift and objective-c files as the same Code collection, with attention to naming conflicts.

  • If you use the framework, make sure that the defines module compilation settings under packaging are set to Yes.

  • If you use the Objective-c Bridge header file, make sure that the Objective-c Bridge header file in the Swift compiler is compiled with code generation that has a path to the project-related header file. This path must be the path of the header file itself, not the directory in which it resides.

  • Xcode uses the name of your engineering module instead of naming the Objective-c Bridge header file with the name of target and the auto-generated header file for Swift code. See Naming Your Product Module.

  • In order to be available in Objective-c, the Swift class must be a subclass of the Objective-c class or be marked with a @objc.

  • When you import swift into Objective-c, remember that OBJECTIVE-C does not convert the features that are unique to swift into OBJECTIVE-C counterparts. See list Using Swift from Objective-c.

  • If you use your own objective-c type in swift code, be sure to import the corresponding Objective-c header file into your swift code before importing the Swift Auto-generated header file into the objective-c. m source file to access S Wift code.

  • Swift claims marked with the private modifier do not appear in the auto-generated header file. Private claims do not leak to objective-c unless they are clearly marked with @ibaction, @IBOutlet, or @objc.

  • For app targets, if there is a objective-c bridge header file, the declaration labeled by the internal modifier appears in the auto-generated header file.

  • For frame targets, only declarations marked with the public modifier appear in the auto-generated header file. You can still use Swift methods and properties that are marked with the internal modifier in the OBJECTIVE-C section of the framework, as long as the class where they are declared inherits from the Objective-c class. For more information about access level modifiers, see Access Control in the Swift programming language

iOS Development--Error summary & common errors and warnings in development summary (10)

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.