"Learn Swift from Scratch" study notes (Day 69) - Swift and Objective-C mixed programming language

Original article, welcome to reprint. Please indicate: Guan Dongsheng's blog 

Before the advent of the Swift language, the development of iOS or OS X applications mainly used the Objective-C language, in addition to the C and C++ languages, but the UI part can only use the Objective-C language.

 

Choose a language

 

After the Swift language appeared, Apple gave programmers more options to allow the two languages ​​to coexist. Since it is coexistence, we have 4 ways to choose:

 

  • Adopt a pure Swift reformist approach;

  • A conservative approach in pure Objective-C ;

  • The left-leaning reformist way of calling Objective-C using Swift ;

  • A right-leaning reformist way of calling Swift in Objective-C . 

file extension

 

When developing iOS or OS X applications in Xcode and other tools , various forms of source files can be written. Originally, Objective-C , C and C++ languages ​​can be used. After the appearance of Swift language, source files have more diverse forms. Description of possible file extensions:



 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326993397&siteId=291194637