BadmintonCat
BadmintonCat

Reputation: 9586

ObjC Header-Only Import in Swift: No Such Module error

I've converted an app project from ObjC to Swift. It uses several ObjC frameworks that are managed with Cocoa Pods.

When I try to build it I get an error:

No such module 'Foo'

The Foo file is an ObjC header file that has no .m file. It is used to bind several other classes into one import (in ObjC). here's how the Foo.h would look:

#import <Foo/FooDefines.h>
#import <Foo/FooToken.h>
#import <Foo/FooAccount.h>
#import <Foo/FooAccountPersistenceInformation.h>
#import <Foo/FooAccountUserInformation.h>
#import <Foo/FooSettings.h>

// Authenticators
#import <Foo/FooAuthenticator.h>
#import <Foo/FooAnonymousAuthenticator.h>
#import <Foo/FooUserPasswordAuthenticator.h>

// UI
#import <Foo/FooViewController.h>
#import <Foo/RLoginDialog.h>
#import <Foo/RLogoutDialog.h>
#import <Foo/RAccountSelectionDialog.h>
#import <Foo/RVerificationDialog.h>
#import <Foo/RBuiltinLogoutActionSheet.h>

// Workflows
#import <Foo/RLoginWorkflow.h>
#import <Foo/RVerificationWorkflow.h>
#import <Foo/RLogoutWorkflow.h>

How would I be able to import this successfully in a Swift class to get beyond the compile-time error?

Upvotes: 0

Views: 1093

Answers (1)

Aravind A R
Aravind A R

Reputation: 2714

Try using #import <Foo/Foo.h> or #import "Foo.h"

Upvotes: 1

Related Questions