What language is the "unbrella" keyword from?

Hi! Developers,

I am learning how to use CocoaPods and trying to understanding what it is adding to the project. After "pod install" the randomly chosen "SwiftyJSON" pod to the test XCode project, a "Pods" project is added.

After opening the auto-generated workspace by CocoaPods, in the XCode navigation panel, there is a "SwiftyJSON.modulemap" file in "Pods->SwiftyJSON->Support Files".

The code in SwiftyJSON.modulemap is like:

framework module SwiftyJSON
umbrella header "SwiftyJSON-umbrella.h"
export *
module * {export * }

I am wondering, what is the programming of the code in this file? Is it Objective-C? or Swift? or some other kind of language? I tried to search the information using the "umbrella" keyword, but couldn't yet find clear reference.

Thank you!

Answered by Claude31 in 683547022

Aren't there extra curly braces ?

framework module SwiftyJSON {
  umbrella header "SwiftyJSON.h"
  export *
  module * { export * }
}

AFAIK, That's C declaration statements.

https://releases.llvm.org/3.3/tools/clang/docs/Modules.html#umbrella-directory-declaration

See also:

https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift

This may clarify as well:

https://developer.apple.com/forums/thread/42737

https://clang.llvm.org/docs/Modules.html#link-declaration

Accepted Answer

Aren't there extra curly braces ?

framework module SwiftyJSON {
  umbrella header "SwiftyJSON.h"
  export *
  module * { export * }
}

AFAIK, That's C declaration statements.

https://releases.llvm.org/3.3/tools/clang/docs/Modules.html#umbrella-directory-declaration

See also:

https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift

This may clarify as well:

https://developer.apple.com/forums/thread/42737

https://clang.llvm.org/docs/Modules.html#link-declaration

Hi Claude31,

Sorry, I missed the curly braces. Yes you are right. The code should be

framework module SwiftyJSON {
  umbrella header "SwiftyJSON.h"
  export *
  module * { export * }
}

Hi Claude31,

The 3rd link you provide have some examples using the "umbrella" keyword. I will try to start understand more from there. I checked the source code of the SwiftyJSON, surprisingly it is written in Swift, even though the CocoaPods adds C code to it. https://github.com/SwiftyJSON/SwiftyJSON

Thank you,

After some reading I think I understand what is the .modulemap file for: it is for the Clang complier to support the newly introduced "module" mechanism for C-like programming languages (C, C++, Objective-C, etc.).

Even though I said "module" is new, I haven't actually check when it is introduced. What I am sure is it is newer than the basic #include mechanism. One of the difference it makes is to allow separate compilation of individual modules.

While the "module" mechanism is being used, the original .h files (header files) of the C-like language library can still be used, and an additional file with .modulemap extension is added to specify which header file is mapped to which module name to be consumed. The syntax of this .mdulemap file is "Module Map Language". https://releases.llvm.org/3.3/tools/clang/docs/Modules.html#module-map-language

What language is the "unbrella" keyword from?
 
 
Q