The regular Command Line Tool template that comes with Xcode doesn't support Swift Frameworks. Swift Applications need a copy of the Swift Standard Libraries in their run path. The regular Cocoa Application template that comes with Xcode copies the Swift Standard Libraries to the app's bundle, but it also comes with storyboards and a lot of stuff that command line applications don't need.
The Swift Command Line Application template provides only what's needed to run a Swift Application using Swift Frameworks.
- Supports Swift Frameworks
- Script that extracts the executable, swift standard libraries and frameworks from the app's bundle.
- Open Xcode and press ⇧⌘9 or go to
File
>New
>Project
- Select
OS X
>Zewo
>Swif Command Line Application
- Press
Next
- Type your
Product Name
, etc.
- Select directory and press
Create
main.swift
will be entry point of your app
- To add Swift Frameworks select the project, app target, and on the
General
tab press+
on theEmbedded Binaries
section.
- Select your frameworks
- That's it (:
Alcatraz is an open-source package manager for Xcode 5+. It lets you discover and install plugins, templates and color schemes without the need for manually cloning or copying files. It installs itself as a part of Xcode and it feels like home.
Install Alcatraz by running:
curl -fsSL https://raw.github.com/alcatraz/Alcatraz/master/Scripts/install.sh | sh
- With Xcode open press ⇧⌘9 or go to
Window
>Package Manager
to open Alcatraz. - Look for Swift Command Line Application under Templates.
- Click on the
INSTALL
button. - Restart Xcode.
- Clone or download the repo.
- Copy the
Project Templates
directory to~/Library/Developer/Xcode/Templates
- If the
~/Library/Developer/Xcode/Templates/Project Templates
directory already exists, copy theZewo
directory to it - Restart Xcode.
Join us on Slack.
Swift Command Line Application Template is released under the MIT license. See LICENSE for details.