Initialization of structures without any constructor in Swift
let rect = Rectangle(
size: Size(width: 10, height: 10),
point: Point(top: 5, left: 5))
struct Size {
var width, height: Int
}
struct Point {
var top, left: Int
}
struct Rectangle {
var size: Size
var point: Point
}
- Log in to post comments