Could not build module Foundation with Objective-C class in Swift - objective-c

I'm attempting to compile a Swift app with supplementary Objective-C files loaded via the bridging header. However, it gets as far as the first line:
#import <Foundation/Foundation.h>
and shows the error:
Could not build the module 'Foundation'
I've checked that the Foundation framework is included but no luck. I've tried various combinations of deployment targets, architectures, etc too. Has anyone else experienced this in Xcode 6 beta 5?

Doc says
Any Objective-C framework (or C library) that’s accessible as a module
can be imported directly into Swift. This includes all of the
Objective-C system frameworks—such as Foundation, UIKit, and SpriteKit
so you could just do
import Foundation

You cannot import Obj-C-Headers in C-Files.
(If you are using c in your project).

Related

Adding a (Swift WatchKit) target to an (Objective-C iOS) app

There are of course many sources of information about interoperability. However there are none specifically about adding a Swift WatchKit target to an Objective-C iOS project.
Of course normally in the iOS project we go to File -> New Target -> WatchKit app -> select Swift or Obj-C and you're done.
Usually adding Swift files to an Obj-C project just requires a bridging-header file and Xcode can create it for you but in my case I am not adding a file.
Lastly, I will be using WatchConnectivity of course with local and remote notifications plus sending data back and forth communicating between both apps. What else should I be aware of?

Cocoapods Obj-C framework with Swift doesn't work

I have installed an obj-c framework in my swift project using cocoapods. In my bridging header file I have imported the framework which works fine.
#import "libPhoneNumber_iOS/NBPhoneNumberUtil.h"
#import "libPhoneNumber_iOS/NBPhoneNumber.h"
However I can't seem to use the classes in my project
let phoneUtil = NBPhoneNumberUtil()
This gives an error that I am using an unresolved identifier.
In my podfile I have use_frameworks!, but I can't import the classes directly in a swift class. In my build settings also I have already set the configuration to use the pod-config file.
The framework works fine if I add it manually to my project (not using cocoapods) and import in my bridging header.
Is this problem a problem with cocoapods or am I doing something wrong? Can't seem to find a way for this to work. Any help would be appreciated. Thanks!

How to view Swift API of AFNetworking?

I am working on a Swift project using AFNetworking. I am using Cocoapods to manage my third-party Obj-C libraries and using bridge-header to import them in the Swift codes.
The problem is that I cannot use CMD+click to find the Swift API of those Obj-C classes (I am always led to Obj-C interface or implementation). I have to guess the format of API according to so-called Obj-C Swift Interaction and it is very annoying sometimes.
Is there any way I can directly check the Swift style API of existing Obj-C libraries?
Thanks in advance!
You can use Alamofire (swift version of AFNetworking) : https://github.com/Alamofire/Alamofire

Can't import Firebase framework into iOS 8 Swift-based *framework*

I am trying to create a swift-based iOS 8 framework, and wanted to include Firebase framework into it. The instructions on Firebase site are only for importing Firebase into iOS apps, which uses bridging headers. Per Apple's instructions, bridging headers don't seem to apply to a Swift framework importing an Objective-C framework. I was looking at the Importing External Frameworks section on the Apple link. It specifies that: "When you import an external framework, make sure the Defines Module build setting for the framework you’re importing is set to Yes."
Despite that, I tried to manually create bridging header and adjusted Swift Compiler - Code Generation Building Settings, to no avail.
Would you know if the Firebase framework has Defines Module build setting set to Yes? If it does, then I'll keep digging into why I get "Use of unresolved identifier Firebase" after explicitly following Firebase instructions a few times. I am using Xcode 6 Beta 5. Any other suggestions and work-arounds are also deeply appreciated.
Here is a work-around I tried, that did not work:
In Xcode 6 Beta 5, I created a new Objective-C framework - SwiftFirebase. In it, I
imported Firebase framework, and the other five frameworks
set the -ObjC flag
copied references of all the .h files in Firebase Headers folder into the new framework - SwiftFirebase.
made those references from Project to Public
imported into the SwiftFirebase umbrella header
ensured that Defines Modules was enabled. It was, by default.
Build for Running.
Created a new Swift-based Framework: TestFramework to test the above SwiftFirebase, where I
Added SwiftFirebase from Debug-iphonesimulator into the new library
Created a new swift class
Imported SwiftFirebase
Added an init method, where I put in the sample swift code from Firebase quick-start.
Build for Running
Got an error compiling: "Firebase/Firebase.h not found"
My guess is that copying references of header files from a Firebase into another Objective-C framework and making them public is not an effective way of manipulating files. :)
Hate to wait for Apple's fix. Anything else I could try? Did I miss something in the above steps that you could think of? Many thanks!

Importing VLCKit (after c59cb1b) in a Swift based project

So I get the latest VLCKit to compile and I see in the xcode project it has it's Defines Module set to Yes in the project Build Settings, and it has the Product Module Name set to VLCKit.
I run make VLCKit to build the framework, everything builds and I get my VLCKit.framework file.
I embed that framework into my Swift based app.
If I use the bridging header, it complains that it can't find the VLCKit/VLCKit.h
from the swift side import VLCKit is also an error.
Anyone get this to work?
Well I managed to fix the issue by just creating a new project VLCKit won't play in my swift bridged project, which is another issue entirely. It will play in a purely obj-c project though.