Swift 6 · Types and protocols
Structs
Structs are value types with memberwise initializers. Mark mutating methods with mutating.
struct Point {
var x: Double
var y: Double
mutating func move(by dx: Double) { x += dx }
}
var p = Point(x: 1, y: 2)
p.move(by: 3)
Official Swift 6 documentation