I built a custom class which holds an "internal" array and offers some useful methods.
class ArrayList<T> {
private var array : Array<T>
public init() {
array = Array<T>()
}
public func add(element : T) {
array.append(element)
}
public func size() -> Int {
return array.count
}
...
}
Ok, that works fine for me so far.
But now I also want to have a method to sort the array. What I already have is the following:
public func sort(comparator : ?) {
array = array.sort(comparator)
}
The question mark stands for the parameter type and that is my problem: Which type must the parameter have? I read something about @noescape<,> but I can't get it to work!
I'm using Swift 2.2.