Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/seanpm2001/learn-swift

A repository for showcasing my knowledge of the Swift programming language, and continuing to learn the language.
https://github.com/seanpm2001/learn-swift

apple collection education gpl3 gplv3 knowledge language learn-swift learn-swift-lang learn-swift-language md swift swift-collection swift-lang swift-language txt

Last synced: about 1 month ago
JSON representation

A repository for showcasing my knowledge of the Swift programming language, and continuing to learn the language.

Awesome Lists containing this project

README

        

***

![/SwiftLogo.jpeg](/SwiftLogo.jpeg)

### Learning Swift (programming language)

I know very little about programming in the Swift programming language. This document will go over all my knowledge of the Swift programming language.

#### Hello World in Swift

Writing a Hello World program in Swift is a lot more difficult than it should be.

```swift
NSString *str = @"hello,";
str = [str stringByAppendingString:@" world"];
```

It can also be written like this:

```swift
var str = "hello,"
str += " world"
```

or possibly like this:

```swift
NSString "Hello World";
```

_/!\ This example has not been tested yet, and may not work_

#### Comments in Swift

Comments in Swift are identical to comments in Java, JavaScript, C, CSS, Google Go, C++, etc..

```swift
// This is a single line comment
/* This
is a multiline
comment */
/* Multi-line comments
* can also
* be written
* like this */
```

#### Break keyword in Swift

```swift
break;
```

To this day, I am still not entirely sure what the `break` keyword does, but most languages support it.

_/!\ This example has not been tested yet, and may not work_

#### Integers in Swift

Swift uses the `let` keyword to set a variable/integer/string in the language. This is an example of getting integers to work.

```swift
let x = int(2);
let y = int(16);
return x ** y;
```

_/!\ This example has not been tested yet, and may not work_

#### Other knowledge of the Swift programming language

1. Swift is a language developed by Apple Inc.

2. Swift is a default language on modern MacOS, iOS, iPadOS, WatchOS, and tvOS, but is also supported on Linux and Windows

3. Swift is a curly bracket and semicolon language

4. Swift uses the `*.swift` file extension

5. Swift is an open source language

6. No other knowledge of the Swift programming language

***