8

When I compile my framework into an iOS app project, I continually get these linker warnings:

<module-includes>:1:1: warning: umbrella header for module 'MyFramework' does not include header 'MyClass+BackdoorExtension.h'
…/AppProject/AppClass.m:123:456 warning: missing submodule MyFramework.MyClass_BackdoorExtension' [-Wincomplete-umbrella]
#import <MyFramework/MyClass+BackdoorExtension.h>

However, unlike these SO answers: 1, 2, 3; I don't want MyClass+BackdoorExtension.h to be lumped in with all the other headers for the framework.  MyClass+BackdoorExtension.h is a hidden “back door” interface for my framework's MyClassusage of the BackdoorExtension's member should produce a error: property 'backdoorMember' not found on object of type 'MyClass *' unless that specific app source file includes MyClass+BackdoorExtension.h.

Prior to Swift modules, this would work as expected without giving linker warnings; backdoorMember was inaccessible unless the app's .m file had a #import <MyFramework/MyClass+BackdoorExtension.h>, after the addition of which everything compiled and ran without warnings or runtime issues.  As it stands, everything compiles & runs as expected, but I'd like to squelch the warning (I'm the type of dev who likes to treat warnings as must-fix errors).  And I'd like to find a way to make this work using the existing aforementioned #import in app Objective-C files and an equivalent import in app Swift files too (e.g. import MyFramework.MyClass+BackdoorExtension).

I've experimented with explicit modules & explicit headers in my framework's module.modulemap to no avail.


Here's my current framework module.modulemap:

module MyFramework {
    umbrella header "MyFramework.h"
    export *
}

and framework umbrella header MyFramework.h:

#import <Foundation/Foundation.h>

#import <MyFramework/BaseClass.h>
#import <MyFramework/MyClass.h>
#import <MyFramework/AnotherClass.h>

And here's the framework's MyClass+BackdoorExtension.h (which has Public Target Membership for the framework):

#import <Foundation/Foundation.h>
#import "MyClass.h"

@interface MyClass (BackdoorExtension)

@property(nonatomic, assign, readonly) BOOL backdoorMember;

@end

I'm using Xcode 8.1 with Apple LLVM version 8.0.0 (clang-800.0.42.1).

Slipp D. Thompson
  • 33,165
  • 3
  • 43
  • 43

0 Answers0