Import Framework in Swift Project, Xcode
If I get you correctly you don't have a separate build target for your framework (you already built it with Xcode 5) and included the framework into your project's build target.
The part of the documentation you're referring to is about frameworks within different targets.
Since your framework is in the project's target this part of the documentation doesn't apply here.
In your case you can't do an import of the framework in your Swift file. That's why you get the error message "No such module myFramework".
myFramework is no module -- it is part of your project's module (which is by default determined by your product name). As such the classes in your framework should be accessible.
However your framework is written in Objective-C. So what you have to do is to import the Swift facing classes in your bridging-header as described here.
Please note that this has nothing to do with the Swift import of a module. The import directive in the bridging-header file just notifies the compiler to 'translate' Objective-C header files to Swift syntax and makes the public header visible to Swift.
So what should you do now?
First import the header files you're interested in in the bridging-header. You only need to import the headers you will interact with in Swift.
Try to compile your project in this stage. If Xcode can't find the header files of the framework your problem is probably not related to Swift or Xcode 6 but a problem with including frameworks in general.
After that try to instantiate a class you imported in the bridging-header, maybe in your AppDelegate.swift. Xcode auto-completion should offer you the type names.
Hope this helps.
Create and import swift framework
I've done with the following steps.
- Create a framework project, for example named "FooKit". (
Cocoa Touch Framework
to be selected) - Create a ".swift" file and add a public symbol, for example
public func foo()
, to it. - Create an use-side (app) project. (I've chosen
Single View Application
) - Open the root directory of "FooKit" by Finder, drag "FooKit.xcodeproj" there and drop it into the app project via
Project Navigator
. - Add "FooKit" to
Target Dependencies
in the app'sBuild Phases
setting. - Add "FooKit.framework" to
Embedded Binaries
in the app'sGeneral
setting.
Now you can build like this code in the use-side app.
import FooKit
func bar() {
foo()
}
Xcode import local Swift Package and build from the app
The solution is to create a local Swift Package in the app project and to import the Shared Package there. Then it will be available in the whole project.
Import Objective-c framework into Swift framework project
You need to import the Beaconstac framework in your umbrella header. That is, if you'd ordinarily use, e.g., #import <Beaconstac/Beaconstac.h>
in an Obj-C bridging header, for a framework you need to put that in the umbrella header.
See this chapter in Apple's documentation for more info:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//
apple_ref/doc/uid/TP40014216-CH10-ID130
Related Topics
iOS Framework Does Not Work on Simulator
Indexpathforrowatpoint Returns Nil Only for First Cell in a UItableview
Swift Delete Multiple Objects at Once Parse Server
No Such Module Iqkeyboardmanagerswift
How to Make Inputaccessoryview Appear Above Uitabbarviewcontroller's Tabs
Shared Iad Banner Bannerviewdidloadad Not Being Called
Wkwebview Allowslinkpreview to False Breaks Text Selection
Start Position of Table View Is Wrong in Simulator, and Is Not The Same in Storyboard
Swiftui: Navigate to Home Screen After Login Completed. Navigating Views by Button Click
Ld: Library Not Found for -Ldoubleconversion React Native 0.59
How to Override Convenience Init in Uialertcontroller for Swift
How to Convert Cgpoint in Nsvalue in Swift
How to Compile Aws Customidentityprovider on Xcode 8 Beta 6
Reusing View in UIpickerview with iOS 7
How to Get System Device Language, Swift iOS
Opencv Error: Assertion Failed on iOS