From d01e5242e16c522becc1b04f9692d2556f94c4f1 Mon Sep 17 00:00:00 2001 From: Damian Rzeszot Date: Mon, 9 Oct 2017 12:01:15 +0200 Subject: swift | fix style guidelines --- pt-pt/swift-pt.html.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pt-pt') diff --git a/pt-pt/swift-pt.html.markdown b/pt-pt/swift-pt.html.markdown index 9462ee1c..f7fab423 100644 --- a/pt-pt/swift-pt.html.markdown +++ b/pt-pt/swift-pt.html.markdown @@ -445,21 +445,21 @@ if let circle = myEmptyCircle { // Enums pode opcionalmente ser um tipo especifico ou não. // Enums podem conter métodos tal como as classes. -enum Suit { - case Spades, Hearts, Diamonds, Clubs +enum suit { + 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 "♧" } } } // Os valores de Enum permitem syntax reduzida, não é preciso escrever o tipo do enum // quando a variável é explicitamente definida. -var suitValue: Suit = .Hearts +var suitValue: Suit = .hearts // Enums que não sejam inteiros obrigam a atribuições valor bruto (raw value) diretas enum BookName: String { -- cgit v1.2.3 From 9a9e52b54bf9bc6ebeefc996452f5944a234557f Mon Sep 17 00:00:00 2001 From: Damian Rzeszot Date: Mon, 9 Oct 2017 12:02:29 +0200 Subject: swift | fix style guidelines --- pt-pt/swift-pt.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pt-pt') diff --git a/pt-pt/swift-pt.html.markdown b/pt-pt/swift-pt.html.markdown index f7fab423..5de2e13b 100644 --- a/pt-pt/swift-pt.html.markdown +++ b/pt-pt/swift-pt.html.markdown @@ -463,10 +463,10 @@ var suitValue: Suit = .hearts // Enums que não sejam inteiros obrigam a atribuições valor bruto (raw value) diretas 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 com valores associados enum Furniture { -- cgit v1.2.3 From e8ee66c854b8833fcb0fd76b5e9ace6ae8379397 Mon Sep 17 00:00:00 2001 From: Damian Rzeszot Date: Mon, 9 Oct 2017 12:03:27 +0200 Subject: swift | fix style guidelines --- pt-pt/swift-pt.html.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pt-pt') diff --git a/pt-pt/swift-pt.html.markdown b/pt-pt/swift-pt.html.markdown index 5de2e13b..6b263942 100644 --- a/pt-pt/swift-pt.html.markdown +++ b/pt-pt/swift-pt.html.markdown @@ -471,23 +471,23 @@ print("Name: \(BookName.john.rawValue)") // Enum com valores associados enum Furniture { // Associar com um inteiro (Int) - case Desk(height: Int) + case desk(height: Int) // Associar com uma String e um Int - 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" -- cgit v1.2.3