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 // Wie Klassen auch können sie Methoden haben
enum Suit { enum Suit {
case Spades, Hearts, Diamonds, Clubs case spades, hearts, diamonds, clubs
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Spades: return "♤" case .spades: return "♤"
case .Hearts: return "♡" case .hearts: return "♡"
case .Diamonds: return "♢" case .diamonds: return "♢"
case .Clubs: return "♧" case .clubs: return "♧"
} }
} }
} }
@ -455,7 +455,7 @@ enum Suit {
// Enum-Werte können vereinfacht geschrieben werden, es muss nicht der Enum-Typ // Enum-Werte können vereinfacht geschrieben werden, es muss nicht der Enum-Typ
// genannt werden, wenn die Variable explizit deklariert wurde // genannt werden, wenn die Variable explizit deklariert wurde
var suitValue: Suit = .Hearts var suitValue: Suit = .hearts
// Nicht-Integer-Enums brauchen direkt zugewiesene "Rohwerte" // Nicht-Integer-Enums brauchen direkt zugewiesene "Rohwerte"
enum BookName: String { enum BookName: String {

View File

@ -446,20 +446,20 @@ if let circle = myEmptyCircle {
// Al igual que las clases, pueden contener métodos // Al igual que las clases, pueden contener métodos
enum Suit { enum Suit {
case Spades, Hearts, Diamonds, Clubs case spades, hearts, diamonds, clubs
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Spades: return "♤" case .spades: return "♤"
case .Hearts: return "♡" case .hearts: return "♡"
case .Diamonds: return "♢" case .diamonds: return "♢"
case .Clubs: return "♧" case .clubs: return "♧"
} }
} }
} }
// Los valores de enum permite la sintaxis corta, sin necesidad de poner // 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 // 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 // Enums de tipo no-entero requiere asignaciones de valores crudas directas
enum BookName: String { enum BookName: String {

View File

@ -389,13 +389,13 @@ if mySquare === mySquare {
// Podem conter métodos do mesmo jeito que classes. // Podem conter métodos do mesmo jeito que classes.
enum Suit { enum Suit {
case Spades, Hearts, Diamonds, Clubs case spades, hearts, diamonds, clubs
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Spades: return "♤" case .spades: return "♤"
case .Hearts: return "♡" case .hearts: return "♡"
case .Diamonds: return "♢" case .diamonds: return "♢"
case .Clubs: 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 pode opcionalmente ser um tipo especifico ou não.
// Enums podem conter métodos tal como as classes. // Enums podem conter métodos tal como as classes.
enum Suit { enum suit {
case Spades, Hearts, Diamonds, Clubs case spades, hearts, diamonds, clubs
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Spades: return "♤" case .spades: return "♤"
case .Hearts: return "♡" case .hearts: return "♡"
case .Diamonds: return "♢" case .diamonds: return "♢"
case .Clubs: return "♧" case .clubs: return "♧"
} }
} }
} }
// Os valores de Enum permitem syntax reduzida, não é preciso escrever o tipo do enum // Os valores de Enum permitem syntax reduzida, não é preciso escrever o tipo do enum
// quando a variável é explicitamente definida. // 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 // Enums que não sejam inteiros obrigam a atribuições valor bruto (raw value) diretas
enum BookName: String { enum BookName: String {

View File

@ -535,20 +535,20 @@ if let circle = myEmptyCircle {
// Они могут содержать методы подобно классам. // Они могут содержать методы подобно классам.
enum Suit { enum Suit {
case Spades, Hearts, Diamonds, Clubs case spades, hearts, diamonds, clubs
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Spades: return "♤" case .spades: return "♤"
case .Hearts: return "♡" case .hearts: return "♡"
case .Diamonds: return "♢" case .diamonds: return "♢"
case .Clubs: return "♧" case .clubs: return "♧"
} }
} }
} }
// Значения перечислений допускают сокращенный синтаксис, нет необходимости // Значения перечислений допускают сокращенный синтаксис, нет необходимости
// указывать тип перечисления, когда переменная объявляется явно // указывать тип перечисления, когда переменная объявляется явно
var suitValue: Suit = .Hearts var suitValue: Suit = .hearts
// Значения нецелочисленных перечислений должны быть указаны явно // Значения нецелочисленных перечислений должны быть указаны явно
// или могут выводится с помощью функции `rawValue` из имени // или могут выводится с помощью функции `rawValue` из имени

View File

@ -518,20 +518,20 @@ if let circle = myEmptyCircle {
// They can contain methods like classes. // They can contain methods like classes.
enum Suit { enum Suit {
case Spades, Hearts, Diamonds, Clubs case spades, hearts, diamonds, clubs
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Spades: return "♤" case .spades: return "♤"
case .Hearts: return "♡" case .hearts: return "♡"
case .Diamonds: return "♢" case .diamonds: return "♢"
case .Clubs: return "♧" case .clubs: return "♧"
} }
} }
} }
// Enum values allow short hand syntax, no need to type the enum type // Enum values allow short hand syntax, no need to type the enum type
// when the variable is explicitly declared // when the variable is explicitly declared
var suitValue: Suit = .Hearts var suitValue: Suit = .hearts
// String enums can have direct raw value assignments // String enums can have direct raw value assignments
// or their raw values will be derived from the Enum field // 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. // Sınıflar gibi metotlar içerebilirler.
enum Kart { enum Kart {
case Kupa, Maca, Sinek, Karo case kupa, maca, sinek, karo
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Maca: return "♤" case .maca: return "♤"
case .Kupa: return "♡" case .kupa: return "♡"
case .Karo: return "♢" case .karo: return "♢"
case .Sinek: 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. // 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. // Integer olmayan enumlar direk değer (rawValue) atama gerektirir.
enum KitapAdi: String { enum KitapAdi: String {

View File

@ -445,19 +445,19 @@ if let circle = myEmptyCircle {
// 枚举可以像类一样,拥有方法 // 枚举可以像类一样,拥有方法
enum Suit { enum Suit {
case Spades, Hearts, Diamonds, Clubs case spades, hearts, diamonds, clubs
func getIcon() -> String { func getIcon() -> String {
switch self { switch self {
case .Spades: return "♤" case .spades: return "♤"
case .Hearts: return "♡" case .hearts: return "♡"
case .Diamonds: return "♢" case .diamonds: return "♢"
case .Clubs: return "♧" case .clubs: return "♧"
} }
} }
} }
// 当变量类型明确指定为某个枚举类型时,赋值时可以省略枚举类型 // 当变量类型明确指定为某个枚举类型时,赋值时可以省略枚举类型
var suitValue: Suit = .Hearts var suitValue: Suit = .hearts
// 非整型的枚举类型需要在定义时赋值 // 非整型的枚举类型需要在定义时赋值
enum BookName: String { enum BookName: String {