Structures definition and initialization in Swift
Forums:
struct Point {
var x, y: Int
}
let p1 = Point(x: 1, y: 2)
//p1.x is 1 and p1.y is 2
let p2: Point
let x2 = p2.x //<- Error
- Log in to post comments
struct Point {
var x, y: Int
}
let p1 = Point(x: 1, y: 2)
//p1.x is 1 and p1.y is 2
let p2: Point
let x2 = p2.x //<- Error