summaryrefslogtreecommitdiffhomepage
path: root/de-de/swift-de.html.markdown
diff options
context:
space:
mode:
authorDmitrii Kuznetsov <torgeek@users.noreply.github.com>2021-02-22 18:36:35 +0300
committerGitHub <noreply@github.com>2021-02-22 18:36:35 +0300
commitbc8bd2646f068cfb402850f7c0f9b1dbfe81e5a0 (patch)
tree89213fd6afbf9cc9303c1c2fa08dafc840a9d99d /de-de/swift-de.html.markdown
parent363d5281f1e3d5bee6339b5316405b0a4b592c49 (diff)
parent110511a10110f96b20f107c078f7d5ef4c01b109 (diff)
Merge pull request #1 from adambard/master
Merge from original adambard
Diffstat (limited to 'de-de/swift-de.html.markdown')
-rw-r--r--de-de/swift-de.html.markdown32
1 files changed, 16 insertions, 16 deletions
diff --git a/de-de/swift-de.html.markdown b/de-de/swift-de.html.markdown
index b58a72d3..08f72a35 100644
--- a/de-de/swift-de.html.markdown
+++ b/de-de/swift-de.html.markdown
@@ -440,13 +440,13 @@ if let circle = myEmptyCircle {
// Wie Klassen auch können sie Methoden haben
enum Suit {
- case Spades, Hearts, Diamonds, Clubs
+ case spades, hearts, diamonds, clubs
func getIcon() -> String {
switch self {
- case .Spades: return "♤"
- case .Hearts: return "♡"
- case .Diamonds: return "♢"
- case .Clubs: return "♧"
+ case .spades: return "♤"
+ case .hearts: return "♡"
+ case .diamonds: return "♢"
+ case .clubs: return "♧"
}
}
}
@@ -455,35 +455,35 @@ enum Suit {
// Enum-Werte können vereinfacht geschrieben werden, es muss nicht der Enum-Typ
// genannt werden, wenn die Variable explizit deklariert wurde
-var suitValue: Suit = .Hearts
+var suitValue: Suit = .hearts
// Nicht-Integer-Enums brauchen direkt zugewiesene "Rohwerte"
enum BookName: String {
- case John = "John"
- case Luke = "Luke"
+ case john = "John"
+ case luke = "Luke"
}
-print("Name: \(BookName.John.rawValue)")
+print("Name: \(BookName.john.rawValue)")
// Enum mit assoziierten Werten
enum Furniture {
// mit Int assoziiert
- case Desk(height: Int)
+ case desk(height: Int)
// mit String und Int assoziiert
- case Chair(String, Int)
-
+ case chair(String, Int)
+
func description() -> String {
switch self {
- case .Desk(let height):
+ case .desk(let height):
return "Desk with \(height) cm"
- case .Chair(let brand, let height):
+ case .chair(let brand, let height):
return "Chair of \(brand) with \(height) cm"
}
}
}
-var desk: Furniture = .Desk(height: 80)
+var desk: Furniture = .desk(height: 80)
print(desk.description()) // "Desk with 80 cm"
-var chair = Furniture.Chair("Foo", 40)
+var chair = Furniture.chair("Foo", 40)
print(chair.description()) // "Chair of Foo with 40 cm"