I need to create a "tools" class or struct with only static methods. As someone coming from a PHP background, structs don't really exist.
I was reading about this Why Choose Struct Over Class? but they do not talk about static structs or static classes.
Which should I use for static methods that are never instanced and why?
Example:
struct BasicTools {
static func split(str: String) -> [String]{
return str.characters.split{$0 == ","}.map(String.init)
}
}
vs
class BasicTools {
static func split(str: String) -> [String]{
return str.characters.split{$0 == ","}.map(String.init)
}
}
In use:
let StrArr: [String] = BasicTools.split("example,example2,example3")