I\'m trying to declare an argument in Swift that takes an optional closure. The function I have declared looks like this:
class Promise { func then(onFulfi
Maybe it's a cleaner way. Specially when the closure has complicated parameters.
typealias SimpleCallBack = () -> () class Promise { func then(onFulfilled: SimpleCallBack, onReject: SimpleCallBack?){ if let callableRjector = onReject { // do stuff! } } }