Slide 13
Slide 13 text
__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("Vector")))
@interface MOCFVector : MOCFBase
- (OCEDVector *)plusOther:(OCEDVector *)other
__attribute__((swift_name("plus(other:)")));
@end
let a = Vector(x: 10, y: 20)
let b = Vector(x: 15, y: 25)
a.plus(other: b)
data class Vector(
val x: Double,
val y: Double,
) {
operator fun plus(other: Vector): Vector =
Vector(x + other.x, y + other.y)
}