2

I am trying to create an iOS framework using swift. I follow this blog and also few others but the output is not the way I want.

Below is my original source file

public class TestClass: NSObject {

    // publicVar description
    public var publicVar: Int = 0

    // doSomething description
    public func doSomething() {
        print("doSomething method")
    }
}

After adding the framework into my project it's create an TestFramwork-Swift.h

enter image description here enter image description here

You can see it's not contain my description. I want the framework header files like Apple.

enter image description here

Can anyone help me to figure out this. I am not able to understand where I am doing wrong. I am also not able to add more swift files into my framework.

Tapas Pal
  • 7,073
  • 8
  • 39
  • 86
  • For the down voter I want to create iOS framework using swift. That's all. Can you provide me a reference? – Tapas Pal Feb 08 '16 at 09:26

1 Answers1

3

Just use triple slash instead of double slash for comments you want to show in your framework headers.

Michaël Azevedo
  • 3,874
  • 7
  • 31
  • 45
  • Thank you. Can you please let me know how to add more swift file? When I add another one into my project it does not appear to the framework. – Tapas Pal Feb 08 '16 at 09:50
  • What do you mean by "not appear" ? Just be sure that your new file has public classes or variable, and that the file has the "target membership" checked for your framework in the File Inspector. – Michaël Azevedo Feb 08 '16 at 09:54
  • I added another file where two public classes are defined along with public methods. Also `target membership` status checked. But when I build the framework only the initial swift file and it's class are coming. Others are not there. – Tapas Pal Feb 08 '16 at 10:02
  • Can you see all your files in your build log then ? http://img15.hostingpics.net/pics/256702Capturedcran20160208110302.png Maybe you should just delete your framework from the project using it and add the new one manually – Michaël Azevedo Feb 08 '16 at 10:04
  • Yes it's there. http://www.hostingpics.net/viewer.php?id=665151ScreenShot20160208at34134PM.png – Tapas Pal Feb 08 '16 at 10:16
  • You should see it in your `TestFramwork-Swift.h` header. You have only one header for all the files in a swift framework. – Michaël Azevedo Feb 08 '16 at 10:18
  • Sorry bro it's also not there and one header file means? How can add more headers file.. Can you please help in details? – Tapas Pal Feb 08 '16 at 10:28
  • Compile your framework, then create a dummy test project. Add your framework on this test project. IF you expand your framework, you will have only two header file, even in your framework is made of multiple swift file. All your classes are defined in your `TestFramwork-Swift.h` file, as you can see in this example : http://img15.hostingpics.net/pics/121463img.png ( The class are determined by `SWIFT_CLASS(...)` – Michaël Azevedo Feb 08 '16 at 10:32
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/102887/discussion-between-tapas-pal-and-michael-azevedo). – Tapas Pal Feb 08 '16 at 11:00