3

We're about to start three new projects and want to use swift from the beginning. I've been looking around, but can't find an answer:

Is there any way to use/create swift based cocoapods and use that pod in a swift project?

Tycho Pandelaar
  • 7,367
  • 8
  • 44
  • 70
  • Apologise for my initial answer, the support at the moment is sketchy so I updated my answer to include links – Daniel Galasko Oct 31 '14 at 15:26
  • if you want less headache I would recommend not to use cocopods, but take a look on _GIT repos_ and its _submodules_ and _subtrees_. much less headache and fully supports _Swift_ as well since... ages. – holex Oct 31 '14 at 16:45

1 Answers1

3

Currently Swift support has not been added to Cocoapods (Check out the discussion).

More discussion links: Here and Here

Xcode does not currently support Swift static libraries either so your only solution is to build your Swift classes into a framework. That being said, the biggest issue with building a framework is that the implementation details of the framework are hidden making it more difficult to actively contribute to your framework and make changes to the code as you develop.

This makes the current popular solution to integrate via subprojects, see AlamoFire and SwiftyJSON

Theres also a discussion on the Apple Forums where they discuss the problems of Frameworks crashing on iOS 7, included below:

In one of the developer talks, they said that if the framework was optional then the main application would continue to run on iOS 7. So for example, you could package an extension with an iOS 7-compatible application, and the extension wouldn't be available but the application would still run. But if the application actually tries to load a framework, it will crash on iOS 7. They described the reason being that iOS doesn't understand the encrypted framework format they are using.

So it seems that a lot of work is underway to get this working. Currently, we build all our internal reusable components in Objective-C and all Apps in Swift.

Community
  • 1
  • 1
Daniel Galasko
  • 23,617
  • 8
  • 77
  • 97