Fork me on GitHub

Alex Rupérez

Published: 04 May 10:51
I starred mattgallagher/CwlUtils at GitHub.
A collection of Swift utilities as documented on
View on GitHub



A collection of utilities written as part of articles on Cocoa with Love

Included functionality

The following features are included in the library.

Adding to your project

This project can be included in your projects in a number of different ways:

The standard restrictions for each of these approaches apply so you'll need to pick an approach based on your situation and preferences.

Minimum requirements are iOS 8 or macOS 10.10.

Manual inclusion

  1. In a subdirectory of your project's directory, run git clone
  2. Drag the "CwlUtils.xcodeproj" file from the Finder to somewhere your in own project's file tree in Xcode
  3. Drag the "CwlUtils.framework" from the "Products" folder of the "CwlUtils" project to the "Copy Files (Frameworks)" build phases of any target that you want to include this module.

Statically included files

This approach generates a concatenated files named CwlUtils.swift that can simply be added to another project (no dynamic frameworks, libraries or other settings required).

This approach will omit the CwlStackFrame.swift, CwlAddressInfo.swift, CwlUnanticipatedError.swift and CwlFrameAddress.c files (since they cannot be included via a single-file approach). If you need these files, please use one of the other inclusion strategies.

  1. Get the latest version of CwlUtils by running git clone on the command-line.
  2. Open the CwlUtils.xcodeproj in Xcode and select the CwlCwlUtilsConcat scheme with a destination of "My Mac" (choose from the Scheme popup in the toolbar or from the "Product" → "Scheme" and "Product" → "Destination" menus in the menubar.
  3. Build the scheme (Command-B or "Product" → "Build")
  4. Open the "Products" folder by right-clicking (or Control-click) on the "Products" folder in the project's file tree in Xcode and select "Show in Finder" and open the "Debug" folder in the "Products" folder that this reveals.

Inside a folder located "Concat_internal" should the file "CwlUtils_internal.swift". You can copy this file and include it in any of your own projects, like any other file.

A folder named "Concat_public" should also be present. This version is almost identical to the "Concat_internal" version except that where the "Concat_internal" version strips public and open specifiers, the "Concat_public" version leaves these in-place. This allows the "Concat_public" version to be use in the "Sources" folder of Swift playgrounds or otherwise used where the features need to be exported from a module.

Swift Package Manager

Add the following to the dependencies array in your "Package.swift" file:

.Package(url: "", majorVersion: 1),

Or, if you're using the swift-tools-version:4.0 package manager, add the following to the dependencies array in your "Package.swift" file:

.package(url: "", majorVersion: 1)

NOTE: even though this git repository includes its dependencies in the Dependencies folder, building via the Swift Package manager fetches and builds these dependencies independently.


Add the following to your target in your "Podfile":

pod 'CwlUtils', :git => ''


Add the following line to your Cartfile:

git "" "master"