2

Here's my Podfile:

platform :ios, '9.0'
use_frameworks!

target :Test_Swift_Import do
  pod 'BFKit-Swift', '1.5.1' //Just a swift pod to provide some methods to test
  pod 'SwiftySwift', '1.0.1' //and another
end

In my AppDelegate class I try to use a simple method from BFKit

BOOL isEmail = [@"not an email" isEmail]; 

My AppDelegate is an objective-c class, not Swift

In order to make this work I try to import the BFKit Swift module

First I try the well-known way:

//Basic <Product_Name-Swift.h>
#import <Test_Swift_Import-Swift.h>

But this SO post and this one too both say to use <ProjectName/ModuleName-Swift.h>. Because the code is in a module, this makes sense to me.

So I try #import <Test_Swift_Import/BFKit-Swift.h>

No deal...

I rename my project to TestSwiftImport in case underscores are a problem

No deal...

I try importing the module directly

<BFKit/BFKit.h>

Alas...

Relevant Xcode Build Settings

defines modules : Yes
Product Module name: TestSwiftImport 
Enable Modules: Yes
Link Frameworks Automatically: Yes
Objective-C Generated Interface Header Name: TestSwiftImport-Swift.h
Objective-C Bridging Header: TestSwiftImport/TestSwiftImport-Bridging-Header.h

Drastic Things I've Tried

I've done all manner of cleaning project and build folder, wiping derived data, resetting simulator, quitting simulator, quitting Xcode and restarting machine, all to no avail. It's sad that these are even things I think of doing and that they sometimes work... But not in this case.

Github Demo Project Displaying Problem

...is here

Any ideas? There are even more failed attempts that you can see if you open the project. This can't be this hard...

Community
  • 1
  • 1
shmim
  • 729
  • 9
  • 21
  • 1
    The product module name for any cocoa pod import should just be itself, have you tried just on its own? And only in the .m file? – bolnad Jan 29 '16 at 00:40
  • That works with quotes! `#import "BFKit-Swift.h" but not brackets. AppCode doesn't like it, but Xcode does. Thanks! – shmim Jan 29 '16 at 01:00
  • this is probably the more useful post for you http://stackoverflow.com/questions/26328034/importing-project-swift-h-into-a-objective-c-class-file-not-found/28484941#28484941 glad to see you got it working – bolnad Jan 29 '16 at 01:12

1 Answers1

1

I see that is problem of CocoaPods.

Now If I try drag file straight to xcode it will work normal. If you really need it. You can drag all file to project. Not use cocoa-pods now.

enter image description here

You can reference to this question: Question

Hope this help!

Community
  • 1
  • 1
vien vu
  • 4,277
  • 2
  • 17
  • 30