remove mkdocs specific syntax

This commit is contained in:
Marcello 2024-06-16 19:14:59 +02:00
parent 8d08c1964f
commit 8026e1465b
Signed by: m-lamonaca
SSH key fingerprint: SHA256:8db8uii6Gweq7TbKixFBioW2T8CbgtyFETyYL3cr3zk
77 changed files with 1128 additions and 1128 deletions

View file

@ -4,7 +4,7 @@
### Macro
```swift linenums="1"
```swift
#if DEBUG
// contents compiled only if in DEBUG build
@ -14,7 +14,7 @@
### Comments
```swift linenums="1"
```swift
// single line comment
/*
@ -24,7 +24,7 @@ multi line comment
### Variables
```swift linenums="1"
```swift
var variable = value // implicit variable init (auto-determine type)
var variable: Type = value // explicit variable init
var variable: Type? = value // explicit nullable variable init
@ -32,13 +32,13 @@ var variable: Type? = value // explicit nullable variable init
### Constants
```swift linenums="1"
```swift
let CONSTANT = value // constant init (value can be assigned at runtime)
```
### Console Output
```swift linenums="1"
```swift
print() // empty line
print(variable)
print("string")
@ -46,7 +46,7 @@ print("string")
## Strings
```swift linenums="1"
```swift
var string "Text: \(<expr>)" // string interpolation
var string = "Hello" + "There" // string concatenation
@ -56,7 +56,7 @@ to make a string span multiple lines"""
## Array
```swift linenums="1"
```swift
var array = ["firstItem", "secondItem", ...]
var array = [Type()] // init empty homogeneous array
@ -81,7 +81,7 @@ It's possible to use a tuple type as the return type of a function to enable the
It's possible to name the elements of a tuple type and use those names to refer to the values of the individual elements.
An element name consists of an identifier followed immediately by a colon (:).
```swift linenums="1"
```swift
var tuple: (Type, Type) = (value, value) // explicit type
var tuple = (value, value) // implicit type
tuple.0 // item access
@ -94,21 +94,21 @@ tuple.name1 // item access
### Tuple Decomposition
```swift linenums="1"
```swift
var tuple = (value1, value2)
var (var1, var2) = tuple // var1 = value1, var2 = value2
```
## Type Identifier
```swift linenums="1"
```swift
typealias Point = (Int, Int)
var origin: (0, 0)
```
## Dictionary
```swift linenums="1"
```swift
var dict = [
"key": "value",
...
@ -204,7 +204,7 @@ dict[key] = value // value update
### Nil Checks
```swift linenums="1"
```swift
variable ?? value
// same as
if(variable == nil) { variable = value }
@ -212,7 +212,7 @@ if(variable == nil) { variable = value }
## If-Else
```swift linenums="1"
```swift
if condition {
// code here
} else if condition {
@ -229,7 +229,7 @@ if var0 != nil { /* statements */ }
### Switch
```swift linenums="1"
```swift
switch <value> {
case <pattern/key>:
// code here
@ -249,7 +249,7 @@ switch <value> {
### For Loop
```swift linenums="1"
```swift
// range based for
for i in start...end { /* statements */ } // end included
for i in start..<end { /* statements */ } // end excluded
@ -266,7 +266,7 @@ for (key, value) in dict {
### While Loop
```swift linenums="1"
```swift
while condition {
// code here
}
@ -279,7 +279,7 @@ repeat {
## Functions
```swift linenums="1"
```swift
// "void function"
func funcName(param: Type, ...) {
// code here
@ -314,14 +314,14 @@ funcWithLabels(value, label: value, ...)
### Passing Functions as Parameters
```swift linenums="1"
```swift
func f(param: Type) -> Type {}
func g(f: (Type) -> Type) {} // (Type) -> Type are the passed func input and output types
```
### Functions Returning Functions
```swift linenums="1"
```swift
func f() -> ((Type) -> Type) {
func g(param: Type) -> type {}
@ -334,7 +334,7 @@ func f() -> ((Type) -> Type) {
**Closures** are self-contained blocks of functionality that can be passed around and used in code.
Closures in Swift are similar to blocks in C and Objective-C and to lambdas in other programming languages.
```swift linenums="1"
```swift
{ (parameters: Type) -> Type in
// statements
}
@ -347,7 +347,7 @@ Closures in Swift are similar to blocks in C and Objective-C and to lambdas in o
### Enum Definition
```swift linenums="1"
```swift
enum EnumName {
case key1
case key2
@ -359,7 +359,7 @@ EnumName.key1 // key1
### Enum with Raw Values
```swift linenums="1"
```swift
enum EnumName: Type {
case key1 = value
case key2 = value
@ -378,7 +378,7 @@ enum IntegerEnum: Int {
### Matching Enumeration Values with a Switch Statement
```swift linenums="1"
```swift
enum Rank: Int {
case ace = 1, two, three, four, five, six, seven, eight, nine, ten
case jack, queen, king
@ -407,7 +407,7 @@ Rank.jack.rawValue // 11
## Struct (Value Type)
```swift linenums="1"
```swift
struct StructName {
var attribute = value // instance variable
private var _attribute: Type // backing field for property
@ -442,7 +442,7 @@ var structure = StructName() // struct instantiation
### Class Definition & Instantiation
```swift linenums="1"
```swift
class ClassName {
var attribute = value // instance variable
private var _attribute: Type // backing field for property
@ -479,7 +479,7 @@ Do actions before/after modifying a property value.
> **Note**: `willSet` and `didSet` do not *set* the value of the property.
```swift linenums="1"
```swift
class ClassName {
var _attribute: Type
@ -501,7 +501,7 @@ class ClassName {
### Inheritance
```swift linenums="1"
```swift
class Derived: SuperClass {
var attribute: Type
@ -518,7 +518,7 @@ class Derived: SuperClass {
### Exception Handling
```swift linenums="1"
```swift
guard let variable = <expression>
else {
/* statements */