swift | fix style guidelines

This commit is contained in:
Damian Rzeszot 2017-10-09 12:01:15 +02:00
parent 62d4b1483b
commit d01e5242e1
8 changed files with 48 additions and 48 deletions

View File

@ -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,7 +455,7 @@ 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 {

View File

@ -446,20 +446,20 @@ if let circle = myEmptyCircle {
// Al igual que las clases, pueden contener métodos
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 "♧"
}
}
}
// Los valores de enum permite la sintaxis corta, sin necesidad de poner
// el tipo del enum cuando la variable es declarada de manera explícita
var suitValue: Suit = .Hearts
var suitValue: Suit = .hearts
// Enums de tipo no-entero requiere asignaciones de valores crudas directas
enum BookName: String {

View File

@ -389,13 +389,13 @@ if mySquare === mySquare {
// Podem conter métodos do mesmo jeito que classes.
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 "♧"
}
}
}

View File

@ -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 {

View File

@ -535,20 +535,20 @@ if let circle = myEmptyCircle {
// Они могут содержать методы подобно классам.
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 "♧"
}
}
}
// Значения перечислений допускают сокращенный синтаксис, нет необходимости
// указывать тип перечисления, когда переменная объявляется явно
var suitValue: Suit = .Hearts
var suitValue: Suit = .hearts
// Значения нецелочисленных перечислений должны быть указаны явно
// или могут выводится с помощью функции `rawValue` из имени

View File

@ -518,20 +518,20 @@ if let circle = myEmptyCircle {
// They can contain methods like classes.
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 "♧"
}
}
}
// Enum values allow short hand syntax, no need to type the enum type
// when the variable is explicitly declared
var suitValue: Suit = .Hearts
var suitValue: Suit = .hearts
// String enums can have direct raw value assignments
// or their raw values will be derived from the Enum field

View File

@ -443,19 +443,19 @@ if let daire = benimBosDairem {
// Sınıflar gibi metotlar içerebilirler.
enum Kart {
case Kupa, Maca, Sinek, Karo
case kupa, maca, sinek, karo
func getIcon() -> String {
switch self {
case .Maca: return "♤"
case .Kupa: return "♡"
case .Karo: return "♢"
case .Sinek: return "♧"
case .maca: return "♤"
case .kupa: return "♡"
case .karo: return "♢"
case .sinek: return "♧"
}
}
}
// Enum değerleri kısayol syntaxa izin verir. Eğer değişken tipi açık olarak belirtildiyse enum tipini yazmaya gerek kalmaz.
var kartTipi: Kart = .Kupa
var kartTipi: Kart = .kupa
// Integer olmayan enumlar direk değer (rawValue) atama gerektirir.
enum KitapAdi: String {

View File

@ -445,19 +445,19 @@ if let circle = myEmptyCircle {
// 枚举可以像类一样,拥有方法
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 "♧"
}
}
}
// 当变量类型明确指定为某个枚举类型时,赋值时可以省略枚举类型
var suitValue: Suit = .Hearts
var suitValue: Suit = .hearts
// 非整型的枚举类型需要在定义时赋值
enum BookName: String {