I created a Swift framework which I want to import in every class I make in my Swift project. I don't want to have to type the import
statement manually, and everywhere. How can I do this?
In Objective-C this would be the same as putting one #import
statement in the pre-compiled header (.pch file).
What I tried
- Create a new Xcode project with the Cocoa Touch Framework template, write all my code in Swift.
- All my extensions and methods in the framework have the
public
keyword. - Added the framework's
.xcodeproj
to my app's Xcode project. - Add the
.framework
in Target Dependencies. - Create a .pch file in my app project (also written in Swift).
- Wrote
<FrameworkName/FrameworkName.h>
in the .pch file. This doesn't solve the problem, and kinda doesn't make sense, because I don't really import anything in theFrameworkName.h
inside the framework project.