Swimat - Swift formatter
-
Upload
jintin-lin -
Category
Technology
-
view
416 -
download
0
Transcript of Swimat - Swift formatter
SwimatJintin
Alcatraz
Usage
curl -fsSL https://raw.github.com/alcatraz/Alcatraz/master/Scripts/install.sh | sh
Usage
Usage
Write a Plugin
Install Template
Create Project
Write Formatter
Compiler
• Source Code
• Scaner
• Lexer
• Parser
Do it yourself
Step
• Separate words
• Indent each block
• Indent incomplete line
• Keep string comment line or block
Separate words
a = b - c a = b + -c
a = b ? c : d a = b?
Function Block
func block() { someFunction() if some == other { some = another } }
Closure Block self.multiBlockFunction({ () -> Void in // success
}, failure: { () -> Void in // failure
}) { () -> Void in // finally
}
Incomplete Line
if a = b { a = c + d }
Incomplete Line
if a = b { a = c + d }
Keep String
let c = "a+b=\(a + b)"
Keep String & Comment
// declare c=a+b
let c = "a+b=\(a + b)"
Q & A