1
私は、デフォルトの関数の引数として演算子>
を使用しようとしている:Swiftでデフォルトの関数引数として演算子を使用できますか?
Playground execution failed: error: StackSorting.playground:27:63:
error: expected expression after unary operator
func sort<T>(..., compare: (T, T) -> Bool = >) where T: Comparable { }
^
私は誰かが短い方法を知っています、それを解決したが...?
func sort<T>(..., compare: (T, T) -> Bool = { $0 > $1 }) where T: Comparable { }