Hello. I have trouble with Numeric.zero property.
I try to check distance between a center minus radius of a body and the beginning of the outer box i.e zero point of coordinates. And I have the error. Can you please explain, what exactly does the static zero property in the Numeric protocol?
protocol Position {
associatedtype Measure: Numeric
var x: Measure { get set }
var y: Measure { get set }
var radius: Measure { get }
}
protocol Boxing {
associatedtype Measure: Numeric
var width: Measure { get }
var height: Measure { get }
}
struct Forum {
func checkDistance<Item: Position, Box: Boxing>(item: Item, box: Box)
where Item.Measure == Box.Measure
{
let edge = item.x - item.radius
if edge < Box.Measure.zero { /* collision */ }
/// Cannot convert value of type 'Item.Measure' to expected argument type 'Unicode.CanonicalCombiningClass'
}
}