пятница, 5 июня 2020 г.

Swift + CLI, Linux

Command Line Interface, CLI

Dependencies

For current session:
$ export PATH=/path/to/swift/usr/bin:"${PATH}"

For all sessions:
$ gedit ~/.bashrc

and add to the end:
export PATH=~/Downloads/swift-5.2.4-RELEASE-ubuntu20.04/usr/bin:"${PATH}"

//or
//export PATH=~/Soft/swift/usr/bin:"${PATH}"

//Windows
export PATH=/mnt/c/tmp/swift/usr/bin:"${PATH}"

Version info
$ swift --version

REPL:
$ swift

For help:
> :help

To exit:
> :exit

Package Manager
$ swift package --help
 
$ mkdir Hello
$ cd Hello 
 
$ swift package init
├── Package.swift
├── README.md
├── Sources
│   └── Hello
│       └── Hello.swift
└── Tests
    ├── HelloTests
    │   └── HelloTests.swift
    └── LinuxMain.swift  

$ swift build
$ swift test
 
Building an Executable
$ mkdir Hello
$ cd Hello
 
$ swift package init --type executable
//main.swift
  
//$ swift build  
$ swift run Hello  

Комментариев нет:

Отправить комментарий