How to set a function as function argument in Swift 3
<p><strong>Q</strong>: Is it possible to pass a function as function argument in Swift 3?</p>

<p>To refactor my code, I want to have a global function. At the end of this function, there is a custom button that has an <code>action</code> argument.</p>

<pre><code>let deleteButton = MIAlertController.Button(title: "cancel", 
                                            type: .cancel, 
                                            config: getDestructiveButtonConfig(),
                                            action: {
                                                print("completed")
                                            })
</code></pre>

<p>What I would like to do is something like, setting up a global function with a function as argument.</p>

<pre><code>MyGlobalStuff.swift
...
func getButton(_ myFunc: func, _ title: String) {
    let deleteButton = MIAlertController.Button(title: title, 
                                            type: .cancel, 
                                            config: getDestructiveButtonConfig(),
                                            action: {
                                                myFunc // call here the function pass by argument
                                            })
}
</code></pre>

<p>Called by <code>getButton(..)</code> with the passed function within the same Class.</p>

<pre><code>MyViewController.swift
...
getButton(myPrintFunc, "cancel")

func myPrintFunc() {
        print("completed")
}
</code></pre>

<p>Is something like that possible? Help is very appreciated.</p>