

Or, alternatively, you can just use the Xcode’s new project template and chose “Command Line Tool” application under macOS (as shown in the picture below). Path : "Sources" ), ] ) Option 2: Using Xcode import PackageDescription let package = Package (ĭependencies : , swift-tools-version: 5.8 // The swift-tools-version declares the minimum version of Swift required to build this package. Option 1: Using Commandsįirst, using following commands you can create a Swift Package. To get started, we need to set up our project and there are two ways to go about it. We’ll be using Xcode and Swift Package Manager (SPM) to create our tool. Let’s build a simple tool called Readometer (Read-o-meter) that reads an input file, counts the words, estimates reading time and displays the outcome.
#BUILD XCODE PROJECT FROM COMMAND LINE HOW TO#
By the end, you’ll have a basic understanding of how to create command-line tools in Swift and be able to apply this knowledge to your own ideas. In this post, we’ll walk through the process of building a tool to estimate reading time using these tools. Using Swift Package Manager (SPM) and swift-argument-parser, it’s even easier to create command-line tools in Swift. This led me to the idea of building a simple command-line tool to estimate the reading time of an input file.Ĭommand-line tools are an efficient way for developers to complete a variety of tasks. However, I realized that I wanted to be able to analyze the time it takes for readers to go through my articles. As a writer, I’ve been using a minimalist editor called Typora to write my articles, and I absolutely love it.
