Carthage dynamic frameworks and other limitations

In this lesson

There are a few things to be aware of before you decide to use Carthage to manage the dependencies in your application. This lesson will tell you about them.

Transcript

Tap on time to skip ahead

00:10

There are a handful of things you must be aware of before choosing Carthage. Again, I’m here at the Carthage repo README on GitHub and I’m on the Supporting Carthage for your Framework section. This applies to you if you’re going to use Carthage.

00:29

First and foremost, Carthage only supports dynamic frameworks. So you need to make sure you are willing to include dynamic frameworks in your application. Secondly, it requires iOS 8 or later. Generally, that’s not a problem as I’ll show you here in a second. But if you’re targeting iOS versions prior to 8 you will not be able to use Carthage. Finally, the dependencies that you are going to reference must share build schemes for frameworks. I’m going to get into all three of these independently.

01:13

One other thing to note while we’re here, if you’re building libraries, make sure you make them compatible with Carthage by sharing your own schemes. I’ll show you how to do that.

01:26

We’re looking here at a project that is using Carthage that I wrote and the first thing I want to show you is all of the dependencies in this project managed by Carthage, generate dynamic frameworks. You can see here that all of my dependencies, some of these are my own libraries, others are third party libraries like CocoaLumberjack or fmdb or Result or Typhoon. As I mentioned in the previous lesson, you must be willing to incorporate all of these as frameworks into your application in order to use Carthage.

02:13

The second Carthage requirement, as I mentioned earlier, is that your deployment target must be at least iOS 8. This is specified in the General Build Settings for your targets. You’ll notice that I have 8.0 as the minimum, but if you select anything prior, if you’re supporting application version anything prior to iOS 8 you cannot use Carthage.

02:41

Of course, if you’re not sure if you want to support iOS 8 or greater, you can always head over to developer.apple.com and it has a graph here that shows you up to- this one was snapshotted a couple weeks ago- it shows you the adoption rates. So here, as of this date, iOS 9 had an 84% adoption rate, iOS 8 11%, so together you’re talking about 95% of the devices that are on the market. Only 5% are running a version of iOS earlier than 8.

03:18

The third thing to remember when you’re referencing dependencies for your applications is that those dependencies must declare framework targets, like this one. So if you were to depend on this library, using Carthage, the SwiftProtocolsSQLite library, which is one of my GitHub projects, I have declared a framework target and I have also created a scheme that builds this framework target and it is shared. This check box down here is clicked.

03:53

Those are the requirements for referencing a dependency using Carthage. Make sure that your GitHub projects that you’re going to use are Carthage compatible by checking those things. Often there’s a tag or a badge on the GitHub repo that tells whether or not it is Carthage compatible.

Additional Info

Register to get access to additional resources and info.