docs/swift/content.md

49 lines
1.6 KiB
Markdown

# What is Swift?
Swift is a high-performance system programming language. It has a clean and modern syntax, offers seamless access to existing C and Objective-C code and frameworks, and is memory safe by default.
Although inspired by Objective-C and many other languages, Swift is not itself a C-derived language. As a complete and independent language, Swift packages core features like flow control, data structures, and functions, with high-level constructs like objects, protocols, closures, and generics. Swift embraces modules, eliminating the need for headers and the code duplication they entail.
To learn more about the programming language, visit [swift.org](https://swift.org).
> [swift.org](https://swift.org/about/)
> [Swift on Github](https://github.com/apple/swift)
%%LOGO%%
# How to use this image
##### Start a REPL
Swift requires [a little bit of extra security privilege](https://github.com/apple/swift-docker/issues/9#issuecomment-272527182) to run the REPL. The following command creates an ephemeral container, attaches your terminal to it and starts the Swift REPL. A great way to try out pre-release builds!
```bash
docker run --cap-add sys_ptrace -it --rm %%IMAGE%% swift
```
##### Pull the Docker Image From Docker Hub:
```bash
docker pull %%IMAGE%%
```
##### Create a Container from the Image and Attach It:
```bash
docker run -it --name swiftfun %%IMAGE%% /bin/bash
```
##### To Start and Attach Your Image Later:
Start your image with name `swiftfun`
```bash
docker start swiftfun
```
and then attach it
```bash
docker attach swiftfun
```