├── fibonacci.swift ├── .devcontainer ├── devcontainer.json └── Dockerfile ├── README.md └── LICENSE /fibonacci.swift: -------------------------------------------------------------------------------- 1 | func fibonacci(_ n: Int) -> Int { 2 | if n == 0 { 3 | return 0 4 | } else if n == 1 { 5 | return 1 6 | } 7 | return fibonacci(n-1) + fibonacci(n-2) 8 | } -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // Created by taki-on based on 2 | // https://github.com/microsoft/vscode-dev-containers/blob/master/containers/swift-4/.devcontainer/devcontainer.json 3 | { 4 | "name": "Swift 5.2.4", 5 | "dockerFile": "Dockerfile", 6 | "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], 7 | "settings": { 8 | "terminal.integrated.shell.linux": "/bin/bash", 9 | "lldb.adapterType": "bundled", 10 | "lldb.executable": "/usr/bin/lldb", 11 | "sourcekit-lsp.serverPath": "/usr/bin/sourcekit-lsp", 12 | "sde.languageServerMode": "sourcekit-lsp" 13 | }, 14 | "extensions": [ 15 | "vknabel.vscode-swift-development-environment", 16 | "vadimcn.vscode-lldb" 17 | ], 18 | "postCreateCommand": "swiftc --version", 19 | "remoteUser": "me" 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swift 5 in GitHub Codespaces 2 | 3 | Do you want to play with Swift 5 in GitHub Codespaces? Just copy this container configuration in your repository and launch your codespace! ♪┏(・o・)┛♪┗ ( ・o・) ┓♪ 4 | 5 | You get the tools to compile your Swift 5 code in your codespace. 6 | 7 | You get syntax highlights, autocompletion, code collapsing and more! 8 | 9 | # Acknowledgement 10 | 11 | This container configuration is based on the pre-built container configuration for Swift 4 by Microsoft you can find [here](https://github.com/microsoft/vscode-dev-containers/tree/master/containers/swift-4). 12 | 13 | This configuration enables [Swift Development Enviroment VS Code extension](https://github.com/vknabel/vscode-swift-development-environment) in your codespace. All features you will get can be found in the extension docs. 14 | 15 | # Contribution 16 | 17 | Something does not work, and you do not know how to proceed? Open an issue :) 18 | 19 | Something seems odd or does not work, and you know how to fix it? Simply open a PR :) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Taehun Kim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # Created by taki-on based on 2 | # https://github.com/microsoft/vscode-dev-containers/blob/master/containers/swift-4/.devcontainer/Dockerfile 3 | 4 | FROM swift:5.2.4 5 | 6 | ARG USERNAME=me 7 | ARG USER_UID=1000 8 | ARG USER_GID=$USER_UID 9 | 10 | RUN apt-get update \ 11 | && export DEBIAN_FRONTEND=noninteractive \ 12 | && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ 13 | && apt-get -y install git openssh-client less iproute2 procps lsb-release \ 14 | && apt-get install libsqlite3-0 libsqlite3-dev libtinfo-dev libncurses5-dev libncursesw5-dev \ 15 | && git clone https://github.com/apple/sourcekit-lsp.git \ 16 | && cd sourcekit-lsp \ 17 | && export PATH="/usr/bin:${PATH}" \ 18 | && swift package update \ 19 | && swift build -Xcxx -I/usr/lib/swift -Xcxx -I/usr/lib/swift/Block \ 20 | && groupadd --gid $USER_GID $USERNAME \ 21 | && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ 22 | && apt-get install -y sudo \ 23 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ 24 | && chmod 0440 /etc/sudoers.d/$USERNAME \ 25 | && apt-get autoremove -y \ 26 | && apt-get clean -y \ 27 | && rm -rf /var/lib/apt/lists/* 28 | --------------------------------------------------------------------------------