The Swift language isn't listed in the complete list of every identifier that you can use in the language hint for syntax highlighting.
Currently, the swift tag is configured for default
language hint (so using <!-- language: swift -->
is the same as <!-- language: default -->
). But that's not enough for Swift, as it won't colorize keywords correctly like:
func
guard
protocol
extension
fileprivate
open
mutating
inout
fallthrough
typealias
willSet
didSet
subscript
Self
convenience
required
init
deinit
unowned
lazy
defer
optional
associatedtype
prefix
infix
It will also wrongly recognize some keywords which aren't existing in Swift:
union
select
I understand that internally, Stack Exchange uses Google Code Prettify, but I also noticed that the Swift extension for Prettify does exist. Sadly, it doesn't seem installed yet on Stack Overflow.
<!-- language: lang-swift -->
, not<!-- language: swift -->
.lang-swift
is added to Stack Exchange, then<!-- language: swift -->
will be the same as<!-- language: lang-swift -->
instead of<!-- language: default -->
#selector
s turning to gray due to#
being a comment in default.