I am looking to create a static VectorCalculator class. Perhaps this function should just be placed in my Vector class (similar to the NSString method -stringByAppendingString in Obj-C) ... and if you think that ... let me know.
In any case, I want to add a couple of static functions to the static VectorCalculator class. It will calculate the "point product" and return the vector. Another function is likely to "calculate and return the angle between two given vectors."
A) Someone will go this way of creating a static class for this or
B) should you just add these functions as instance functions of the Vector class, such as ... public func dotProductWithVector(v: Vector) -> Vector and public func angleWithVector(v: Vector) -> Double . And then both of these argument vectors v will be applied to the main classes Vector Vector u .
What is the advantage of transition A or B?
If you think B is for future reference, how would you create the entire static class in Swift?
source share