mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-02-10 10:19:40 +00:00
Adds basic support for the Swift programming language
Text only lexer for now until Pygments catches up
This commit is contained in:
14
samples/Swift/section-73.swift
Normal file
14
samples/Swift/section-73.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
enum ServerResponse {
|
||||
case Result(String, String)
|
||||
case Error(String)
|
||||
}
|
||||
|
||||
let success = ServerResponse.Result("6:00 am", "8:09 pm")
|
||||
let failure = ServerResponse.Error("Out of cheese.")
|
||||
|
||||
switch success {
|
||||
case let .Result(sunrise, sunset):
|
||||
let serverResponse = "Sunrise is at \(sunrise) and sunset is at \(sunset)."
|
||||
case let .Error(error):
|
||||
let serverResponse = "Failure... \(error)"
|
||||
}
|
||||
Reference in New Issue
Block a user