Swift

The Swift badge, lettered “Swift Squadron · Fast · Safe” round its band
Files
.swift
Formats as
swift-format
Lints
Every rule that reads its code
In ur.toml
[format.swift]

Formatted

Cart.swift, as written
// What a cart costs.
struct Item {
    let name: String
    let price: Int
    let quantity: Int
}
func subtotal(_ items: [Item]) -> Int {
    var sum = 0
    for item in items where item.quantity > 0 {
        sum += item.price * item.quantity
    }
    return sum
}
let codes = [
    "SPRING",
    "WELCOME"
]
let range = 0 ..< codes.count
ur format --style swift-format Cart.swift
// What a cart costs.
struct Item {
  let name: String
  let price: Int
  let quantity: Int
}
func subtotal(_ items: [Item]) -> Int {
  var sum = 0
  for item in items where item.quantity > 0 {
    sum += item.price * item.quantity
  }
  return sum
}
let codes = [
  "SPRING",
  "WELCOME",
]
let range = 0..<codes.count

Try it in the playground →

Versions

Ur reads Swift as the profiles below name it. Name the versions a project targets in target; without it, Ur reads swift-6.

ProfileDialect
swift-5Swiftc
swift-6Swiftc