scalessec/Toast-Swift

You can use "typealias" instead of "ToastCompletionWrapper"

Closed this issue · 1 comments

You can use:
typealias completion = ((Bool) -> Void)?
instead of:
private class ToastCompletionWrapper {
let completion: ((Bool) -> Void)?

    init(_ completion: ((Bool) -> Void)?) {
        self.completion = completion
    }
}

The objc_setAssociatedObject API requires the associated object to be a class, so unfortunately simply using a typealias for the completion closure does not work.