homepage

home seiten a-z swift <-- hoch --> bottom home/swift/keywords

Swift Schlüsselwörter

Schlüsselwörter, die in

verwendet werden.

Schlüsselwörter für Deklarationen

Schlüsselwort Anmerkung
associatedtype Ein zugeordneter Typ <_associated type_=""> kann verwendet werden, um ein Protokoll generisch zu machen.
class  
deinit  
enum  
fileprivate Wird als Zugriffsmodifizierer <_access modifier_=""> genutzt.
import  
init  
inout  
internal Wird als Zugriffsmodifizierer <_access modifier_=""> genutzt.
let  
open Wird als Zugriffsmodifizierer <_access modifier_=""> genutzt.
operator  
private Wird als Zugriffsmodifizierer <_access modifier_=""> genutzt.
public Wird als Zugriffsmodifizierer <_access modifier_=""> genutzt.
rethrows  
static  
struct  
subscript  
typealias  
var  

rauf runter

Schlüsselwörter für Anweisungen

Schlüsselwort Anmerkung
break Beendet die Ausführung einer Schleife oder einer if oder switch Anweisung.
case Used for pattern testing.
catch Behandlung potenzieller Fehler, die durch eine auslösende Funktion throws verursacht werden.
continue Beendet die Ausführung der aktuellen Iteration einer Schleife, stoppt jedoch nicht die Ausführung der Schleife.
default Wird für Standardfälle im switch verwendet.
defer Einen Block vor Beenden einer Funktion ausführen.
do Wird zum Erstellen von do Blöcken verwendet (do-while, do-catch).
else Ausführen eines Blocks, wenn eine Bedingung nicht erfüllt ist.
fallthrough
for Durchlaufen einer Sequenz.
guard Zustandsbewertung und Entpacken von Optionals.
if Zustandsbewertung.
in In closures als Trennzeichen zwischen dem Funktionstyp und dem Funktionskörper und Überprüfung ob sich ein Objekt in einer Sequenz befindet.
repeat A control flow statement, similar to while loop
return
throw Auslösen eines Fehlers in einer Funktion, die einen Fehler auslöst throws.
switch Vergleicht einen Wert mit mehreren möglichen Übereinstimmungsmustern.
where Herausfiltern von Werten in Anweisungen wie switch, for, protocol extension, first, contains und initializers.
while Führt eine Schleife aus, bis eine Bedingung false wird.

rauf runter

Schlüsselwörter für Ausdrücke und Typen

Schlüsselwort Anmerkung
any Any can represent an instance of any type at all, including function types.
as Used for type casting.
catch Used in error handling, when an error is thrown, it’s matched against the catch clauses.
false A literal used to express booleans.
is Used to check whether an object is of a certain class type
nil A valueless state that could be assigned to optionals.
rethrows allows forwarding a thrown error by a given function parameter
self “self” refers to the current object within a class or struct.
Self Refers to a type – usually the current type in the current context.
super super is used to call up to your superclass.
throw Used for throwing an error in a function that throws.
throws To mark a function throwing.
true A literal used to express booleans.
try The try keyword is used to indicate that a method can throw an error. To catch and handle an error, the throwing method call needs to be wrapped in a do-catch statement.

rauf runter

Schlüsselwörter für Muster

Schlüsselwort Anmerkung
-  

rauf runter

Schlüsselwörter die mit einem Nummernzeichen (#) beginnen

Schlüsselwort Anmerkung
#available Used to determine the availability of APIs at runtime
#colorLiteral Used to make the XCode IDE to display a color swatch 🟥
#column column number of the line where it is being run.
#dsohandle
#elseif Literal conditional statement
#else Literal else statement.
#endif Literal marker for closing an a literal if statement
#error Creates a red compiler error & prevents code from compiling
#fileID Generates concise file string in all language modes.
#fileLiteral Used to make the XCode IDE link to a local file.
#filePath Outputs the file path of in which code is being run.
#file Outputs the name of the file in which code is being run.
#function Outputs the name of the function where code belongs.
#if Literal if statement.
#imageLiteral Used to make the XCode IDE to display an image.
#keyPath
#line line number where it is being run.
#selector
#sourceLocation
#warning will cause Xcode to display a warning with the given message.

rauf runter

Schlüsselwörter in bestimmten Kontexten

Schlüsselwort Anmerkung
associativity defines how operators of the same precedence are grouped together.
convenience Convenience modifier placed before the init keyword.
didSet A property observer
dynamic A declaration modifier used to make use of Objective-C’s dynamism.
final One of Swift’s access modifiers.
get Used when getting a computed property.
indirect Used for recursive Enums
infix Used when creating custom operators.
lazy Used for just-in-time calculation.
left Used to specify the associativity of a custom operator
mutating Functions marked as mutating can change any property within its enclosing value
none Used to specify the associativity of a custom operator
nonmutating
optional
override Used for overriding child classes.
postfix Used in creating custom functions, it’s mathematical notation in which operators follow operands.
precedence Operator precedence is a set of rules that determine which operator is executed before another.
prefix Used in creating custom functions, it’s mathematical notation in which operators follow operands.
protocol A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality.
required Required keyword means that inheriting classes must provide an implementation of the method.
right Used to specify the associativity of a custom operator
set Used when getting a computed property.
some denotes an opaque type.
Type A metatype type refers to the type of any type, including class types, structure types, enumeration types, and protocol types.
unowned A reference type, used for memory management.
weak A reference type, used for memory management.
willSet A property observer


Swift Reserved Keywords, with brief explanations. von Deya Eldeen, 2022
All the Reserved Keywords in Swift von Artturi Jalli, 2021


home seiten a-z swift <-- hoch --> top