Coder Social home page Coder Social logo

yonaskolb / swift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apple/swift

0.0 2.0 0.0 189.38 MB

The Swift Programming Language

Home Page: https://swift.org/

License: Apache License 2.0

Emacs Lisp 0.14% CMake 0.80% Python 1.65% DTrace 0.01% Swift 40.91% Objective-C 0.59% C++ 54.55% Objective-C++ 0.56% C 0.13% Assembly 0.01% LLVM 0.15% Shell 0.46% Ruby 0.01% Perl 0.01% Makefile 0.01% Vim Script 0.04%

swift's Introduction

Swift logo

# Swift Programming Language
Swift Package
macOS Build Status Build Status
Ubuntu 14.04 Build Status Build Status
Ubuntu 15.10 Build Status Build Status
Ubuntu 16.04 Build Status Build Status
Ubuntu 16.10 Build Status Build Status

Welcome to 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.

Documentation

To read the documentation, start by installing the Sphinx documentation generator tool by running the command:

easy_install -U Sphinx

Once complete, you can build the Swift documentation by changing directory into docs and typing make. This compiles the .rst files in the docs directory into HTML in the docs/_build/html directory.

Many of the docs are out of date, but you can see some historical design documents in the docs directory.

Another source of documentation is the standard library itself, located in stdlib. Much of the language is actually implemented in the library (including Int), and the standard library gives some examples of what can be expressed today.

Getting Started

These instructions give the most direct path to a working Swift development environment. Options for doing things differently are discussed below.

System Requirements

macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release are the current supported host development operating systems.

For macOS, you need the latest Xcode.

For Ubuntu, you'll need the following development dependencies:

sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev

Note: LLDB currently requires at least swig-1.3.40 but will successfully build with version 2 shipped with Ubuntu.

If you are building on Ubuntu 14.04 LTS, you'll need to upgrade your clang compiler for C++14 support and create a symlink:

sudo apt-get install clang-3.6
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100

Getting Sources for Swift and Related Projects

First create a directory for all of the Swift sources:

mkdir swift-source
cd swift-source

Note: This is important since update-checkout (see below) checks out repositories next to the Swift source directory. This means that if one clones Swift and has other unrelated repositories, update-checkout may not clone those repositories and will update them instead.

Via HTTPS For those checking out sources as read-only, HTTPS works best:

git clone https://github.com/apple/swift.git
./swift/utils/update-checkout --clone

Via SSH For those who plan on regularly making direct commits, cloning over SSH may provide a better experience (which requires uploading SSH keys to GitHub):

git clone [email protected]:apple/swift.git
./swift/utils/update-checkout --clone-with-ssh

CMake

CMake is the core infrastructure used to configure builds of Swift and its companion projects; at least version 3.4.3 is required. Your favorite Linux distribution likely already has a CMake package you can install. On macOS, you can download the CMake Binary Distribution, bundled as an application, copy it to /Applications, and add the embedded command line tools to your PATH:

export PATH=/Applications/CMake.app/Contents/bin:$PATH

Ninja

Ninja is the current recommended build system for building Swift and is the default configuration generated by CMake. If you're on macOS or don't install it as part of your Linux distribution, clone it next to the other projects and it will be bootstrapped automatically:

Build from source

Via HTTPS

git clone https://github.com/ninja-build/ninja.git && cd ninja
git checkout release
cat README

Via SSH

git clone [email protected]:ninja-build/ninja.git && cd ninja
git checkout release
cat README

Install via third-party packaging tool (macOS only)

Homebrew

brew install cmake ninja

MacPorts

sudo port install cmake ninja

Building Swift

The build-script is a high-level build automation script that supports basic options such as building a Swift-compatible LLDB, building the Swift Package Manager, building for iOS, running tests after builds, and more. It also supports presets, which you can define for common combinations of build options.

To find out more:

utils/build-script -h

Note: Arguments after "--" above are forwarded to build-script-impl, which is the ultimate shell script that invokes the actual build and test commands.

A basic command to build Swift with optimizations and run basic tests with Ninja:

utils/build-script -r -t

Developing Swift in Xcode

build-script can also generate Xcode projects:

utils/build-script -x

The Xcode IDE can be used to edit the Swift source code, but it is not currently fully supported as a build environment for SDKs other than macOS. If you need to work with other SDKs, you'll need to create a second build using Ninja.

Testing Swift

See docs/Testing.rst.

Contributing to Swift

Contributions to Swift are welcomed and encouraged! Please see the Contributing to Swift guide.

To be a truly great community, Swift.org needs to welcome developers from all walks of life, with different backgrounds, and with a wide range of experience. A diverse and friendly community will have more great ideas, more unique perspectives, and produce more great code. We will work diligently to make the Swift community welcoming to everyone.

To give clarity of what is expected of our members, Swift has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates our values well. For more, see the Code of Conduct.

swift's People

Contributors

lattner avatar gribozavr avatar douggregor avatar jckarter avatar jrose-apple avatar gottesmm avatar rjmccall avatar practicalswift avatar slavapestov avatar rudkx avatar nadavrot avatar adrian-prantl avatar swift-ci avatar akyrtzi avatar eeckstein avatar aschwaighofer avatar tkremenek avatar trentxintong avatar swiftix avatar bitjammer avatar benlangmuir avatar nkcsgexi avatar davezarzycki avatar atrick avatar annazaks avatar jopamer avatar milseman avatar cwakamo avatar cwillmor avatar modocache avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.