title: How to reuse Swift code in other projects?
body: <p>I wrote a class in Swift. I want to use this code in two separate iOS app projects that I wrote. Both the shared code and the apps are written in Swift. What is the best way of doing that?</p>
  
  <p>I tried to create both a framework and a library in Swift and then add it as a sub-project to my app. In both cases I could not make the app see the module. I tried to add the shared module to "Target Dependencies" and "Link Binary With Libraries" of the main app's target. No luck - the app still can not see the classes of the shared module.</p>
  
  <p>Using Xcode6 Beta6 at the moment.</p>
  
  <h2>Solution</h2>
  
  <p>As Konstantin Koval and Heliem pointed out, all I needed is to use <code>public</code> in my class and method declarations, in the shared module. Now all works, both if I use workspace and if I add the module as a subproject.</p>
  
  <h2>Update</h2>
  
  <p>I just found an excellent easy solution for reusing code between projects in Swift. It is called Carthage (<a href="https://github.com/Carthage/Carthage">https://github.com/Carthage/Carthage</a>). This is not a plug as I am not affiliated with it in any way, I just really like it. It works in iOS 8+.</p>