Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a swift class to my framework header?

Tags:

swift

xcode6

ios8

In Xcode 6 (beta 4 6A267n), I added a Framework (selecting Swift as the language) and the framework header has this comment: // In this header, you should import all the public headers of your framework using statements like #import

Through SO I found that you have to append "-Swift" to your header file name, however I was not able to get this to work.

I've also added $(SRCROOT) to my header search path.

like image 419
chrisp Avatar asked Jul 25 '14 03:07

chrisp


People also ask

How do I add Swift class to Objective-C project?

To access and use swift classes or libraries in objective-c files start with an objective-c project that already contains some files. Add a new Swift file to the project. In the menu select File>New>File… then select Swift File, instead of Cocoa Touch Class. Name the file and hit create.


1 Answers

It sounds like you are trying to create your own Swift library? In which case, you do not need to create an external interface as described here:

Swift: how can I create external interface for static library (public headers analog in Objective-C .h)

With Swift you identify your public interface by marking classes and methods as public.

The header that has the -Swift suffix is a bridging header and is what you use to bridge Objective-C code so that it can be used in your Swift application.

like image 92
ColinE Avatar answered Sep 23 '22 01:09

ColinE