colon - ApplebaumIan/BitbucketAPI GitHub Wiki
Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.
- Identifier: colon
- Enabled by default: Enabled
- Supports autocorrection: Yes
- Kind: style
- Analyzer rule: No
- Minimum Swift compiler version: 3.0.0
- Default configuration: warning, flexible_right_spacing: false, apply_to_dictionaries: true
let abc: Voidlet abc: [Void: Void]let abc: (Void, Void)let abc: ([Void], String, Int)let abc: [([Void], String, Int)]let abc: String="def"let abc: Int=0let abc: Enum=Enum.Valuefunc abc(def: Void) {}func abc(def: Void, ghi: Void) {}let abc: String = "abc:"let abc = [Void: Void]()let abc = [1: [3: 2], 3: 4]let abc = ["string": "string"]let abc = ["string:string": "string"]let abc: [String: Int]func foo(bar: [String: Int]) {}func foo() -> [String: Int] { return [:] }let abc: Anylet abc: [Any: Int]let abc: [String: Any]class Foo: Bar {}class Foo<T>: Bar {}class Foo<T: Equatable>: Bar {}class Foo<T, U>: Bar {}class Foo<T: Equatable> {}switch foo {
case .bar:
_ = something()
}object.method(x: 5, y: "string")object.method(x: 5, y:
"string")object.method(5, y: "string")func abc() { def(ghi: jkl) }func abc(def: Void) { ghi(jkl: mno) }class ABC { let def = ghi(jkl: mno) } }func foo() { let dict = [1: 1] }let aaa = Self.bbb ? Self.ccc : Self.ddd else {
return nil
Example("}
let ↓abc:Voidlet ↓abc: Voidlet ↓abc :Voidlet ↓abc : Voidlet ↓abc : [Void: Void]let ↓abc : (Void, String, Int)let ↓abc : ([Void], String, Int)let ↓abc : [([Void], String, Int)]let ↓abc: (Void, String, Int)let ↓abc: ([Void], String, Int)let ↓abc: [([Void], String, Int)]let ↓abc :String="def"let ↓abc :Int=0let ↓abc :Int = 0let ↓abc:Int=0let ↓abc:Int = 0let ↓abc:Enum=Enum.Valuefunc abc(↓def:Void) {}func abc(↓def: Void) {}func abc(↓def :Void) {}func abc(↓def : Void) {}func abc(def: Void, ↓ghi :Void) {}let abc = [Void↓:Void]()let abc = [Void↓ : Void]()let abc = [Void↓: Void]()let abc = [Void↓ : Void]()let abc = [1: [3↓ : 2], 3: 4]let abc = [1: [3↓ : 2], 3↓: 4]let abc: [↓String : Int]let abc: [↓String:Int]func foo(bar: [↓String : Int]) {}func foo(bar: [↓String:Int]) {}func foo() -> [↓String : Int] { return [:] }func foo() -> [↓String:Int] { return [:] }let ↓abc : Anylet abc: [↓Any : Int]let abc: [↓String : Any]class ↓Foo : Bar {}class ↓Foo:Bar {}class ↓Foo<T> : Bar {}class ↓Foo<T>:Bar {}class ↓Foo<T, U>:Bar {}class ↓Foo<T: Equatable>:Bar {}class Foo<↓T:Equatable> {}class Foo<↓T : Equatable> {}object.method(x: 5, y↓ : "string")object.method(x↓:5, y: "string")object.method(x↓: 5, y: "string")func abc() { def(ghi↓:jkl) }func abc(def: Void) { ghi(jkl↓:mno) }class ABC { let def = ghi(jkl↓:mno) } }func foo() { let dict = [1↓ : 1] }