Commandant icon indicating copy to clipboard operation
Commandant copied to clipboard

How to start a new Xcode Project using Commandant?

Open alvivi opened this issue 8 years ago • 7 comments

I want to create new Xcode project to build a CLI tool. So I open Xcode, I create a new command line tool project (using swift), then I try to add Commandant as a dependency, but, I cannot add frameworks as a dependency.

All the projects using Commandant have very peculiar xcodeproj. They seem standard OSX apps, but they are using build phases like "Extract CLI Tool".

Am I missing a tool or a bootstrap project?

alvivi avatar Jul 29 '15 23:07 alvivi

You have to jump through some hoops to use Swift in a CLI tool. I'd try to copy what Carthage does.

mdiep avatar Jul 29 '15 23:07 mdiep

The root of the problem is that CLI tools statically link the swift stdlib while frameworks dynamically link it. AFAIK there's no way to force dynamic linkage of the stdlib for non-app bundles (c.f. Carthage/Carthage#16).

neilpa avatar Jul 30 '15 00:07 neilpa

Can anyone create a summary of how to use Commandant in a CLI Xcode project (and put it in the README)? Sure, I could look through Carthage's source, but there's a lot more to Carthage than just Commandant, so I would be wasting my time looking through it. Thanks

Danappelxx avatar Oct 04 '15 20:10 Danappelxx

I agree with @Danappelxx . I need some simple template project for creating CLI tool with Commandant. Carthage it self is too complicated as starting point to learn how to use Commandant.

griffin-stewie avatar Sep 25 '16 08:09 griffin-stewie

This would be a great thing to add to the Commandant repo. PRs welcome!

mdiep avatar Sep 25 '16 12:09 mdiep

The easiest way probably is to use the SwiftPM and generating the xcodeproj.

$ swift package init --type executable Then adding Commandant as dependency. At the end just run $ swift package generate-xcodeproj

vknabel avatar Dec 08 '16 00:12 vknabel

Thank you @vknabel . It works!

griffin-stewie avatar Dec 10 '16 14:12 griffin-stewie