Using CocoaPods to just build frameworks for use elsewhere

I am definitely not a fan of CocoaPods, I use Carthage in all of my projects. It is not ideal but I have a way of using it that works for me.

Recently I was faced with a problem that made me use CocoaPods but in a quite different way, just to build some frameworks to be used elsewhere without CocoaPods.

The problem

I use GRDB.swift to work with the database in iOS applications, especially because it support using SQLCipher to have the database encrypted. The current version 3.x has some problem when used by Xcode 10.2 and Swift 5 so using the latest 4.0 is recommend.

GRDB.swift never supported Carthage but there was always a way to make it work. I usually just needed to delete some of the shared schemes and run carthage build instead of carthage bootstrap. I was not able to make Carthage work with 4.0, mainly because the targets changed. There is no GRDBCipher target for use with SQLCipher anymore, just a podspec definition

  s.subspec 'SQLCipher' do |ss|
    ss.source_files = 'GRDB/**/*.swift', 'Support/*.h'
    ss.framework = 'Foundation'
    ss.dependency 'SQLCipher', '>= 3.4.0'
    ss.xcconfig = {

It looks like only using CocoaPods and SwiftPM is now supported, there is not even an easy way to do manual installation.

I had to decide how to integrate 4.0 to my project in the best way possible.

[Read More]

Generating a list of libraries your iOS app uses

If you work on an iOS app that is a bit more corporate you probably need to show the list of all the libraries you use with their licenses somewhere in the app. Creating and updating this list by hand is a pain. If you use Carthage to manage all your dependencies (and you really should) there is a handy script by Piet Brauer I contributed to that will help you.

When you run the script using $ ./PATH_TO_YOUR_SCRIPT/fetch_licenses.swift Cartfile.resolved OUTPUT_DIR it reads your Carthage file, gets all the libraries you use, downloads their licenses and stores them all in a single plist file. The plist file contains the name, license name and full license content for every library in your Carthage file.

There is currently no support for using multiple Carthage files (when you have more projects in your workspace), you need to generate the plist file for each of them separately and then merge them manually. But you can set up a bash script to do it for you.

[Read More]