A repository for showcasing my knowledge of the Swift programming language, and continuing to learn the language
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.
NSString *str = @"hello,";
str = [str stringByAppendingString:@" world"];
It can also be written like this:
var str = "hello,"
str += " world"
or possibly like this:
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..
// This is a single line comment
/* This
is a multiline
comment */
/* Multi-line comments
* can also
* be written
* like this */
Break keyword in 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.
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
-
Swift is a language developed by Apple Inc.
-
Swift is a default language on modern MacOS, iOS, iPadOS, WatchOS, and tvOS, but is also supported on Linux and Windows
-
Swift is a curly bracket and semicolon language
-
Swift uses the
*.swift
file extension -
Swift is an open source language
-
No other knowledge of the Swift programming language