What is an umbrella title?

What is basically an umbrella header? What is its use? I received a warning as shown below. What does it mean?

<module-includes>:1:1: warning: umbrella header for module 'XCTest' does not include header 'XCTextCase+AsynchronousTesting.h' [-Wincomplete-umbrella] #import "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCTest.h" 
+65
ios objective-c
Jul 6 '15 at 6:10
source share
2 answers

The umbrella header is the master header file for the framework. Its use is that you can write

 #import <UIKit/UIKit.h> 

instead

 #import <UIKit/UIViewController.h> #import <UIKit/UILabel.h> #import <UIKit/UIButton.h> #import <UIKit/UIDatePicker.h> 

etc.

For me, <XCTest/XCTestCase+AsynchronousTesting.h> included in <XCTest/XCTest.h> . Maybe this is not for you? In this case, add

 #import <XCTest/XCTestCase+AsynchronousTesting.h> 

manually.

+63
Jul 06 '15 at 6:24
source share

umbrella header - iOS framework or library in Objective-C may have a header file that contains links to all other headers in this project.

When you create the target framework, Xcode will automatically generate the <targer_name>.h file. It must have the same name as Product Name

Build Settings :

  • Product Name - Default: $(TARGET_NAME:c99extidentifier)
  • Product Module Name - The default value is $(PRODUCT_NAME:c99extidentifier)

For example, <umbrella_name>.h looks like

 #import "header_1.h" #import "header_2.h" 

As a result, you can use the following syntax

 #import <umbrella_name>.h 

instead

 #import <header_1>.h #import <header_2>.h 

Also, the umbrella header also required by a typical module map structure [About] [Framework module example] [Manually creation]

In practice, when you create a Framework in Objective-C [Example] or Swift [Example] , this file will be created automatically using <product_name>

Import Objective-C into Swift as part of the target platform

In the umbrella header, import each Objective-C header that you want to represent in Swift.

Swift sees all the headers you publish in the umbrella header. The contents of the Objective-C files in this platform are automatically accessible from any Swift file in this target platform without import statements. Use classes and other declarations from your Objective-C code with the same Swift syntax that you use for system classes.

+1
Aug 13 '19 at 15:50
source share



All Articles