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()
}