Q:

Show UIAlertView from UITableViewCell in TableView

Beginner here.  Having a hard time understanding delegates and how to implement them.  
I have a TableViewCell that determines whether or not an audio file is present.  
If no audio file, show an alertView in the tableView that contains the tableViewCell.  I was told that using delegates would solve this problem but no idea how to use them.  
Here is the code for the TableViewCell and where it determines whether or not to show alert:
    class TablePostCellView: UITableViewCell, AVAudioPlayerDelegate {
    ...
    @IBAction func playAudio(sender: AnyObject) {
    //self.post?.audioObject.parsePlaySound()
    if self.post?.audioObject.parseSoundPlayBack == nil{
        println("no audio show alert")
    } else{
        println("playAudio")
        parseSoundPlayBack.play()
    }
}

I read this: Presenting UIAlertController from UITableViewCell but it didn't really help me. 

A:

Lot's of folks will tell you to implement a delegate/protocol pattern between the UITableView and the UITableViewCell.  They usually mean something like this:
protocol AudioPlayable {
    func playSoundsIfAble()
}

class SomeCell: UITableViewCell {
    var delegate: AudioPlayable? 
    @IBAction func userDidSomething(sender: AnyObject) {
        delegate?.playSoundsIfAble()
}

class SomeTableView: UITableViewController {
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell = tableView.dequeReusableCellWithIdentifier("abcd") as SomeCell! 
        cell.delegate = self
        return cell
    }

    func playSoundsIfAble() {
        //Play the sound or show the alert
    }
}

But as common as the delegate protocol pattern is, why not get ahead of the curve and do it with functions as first class citizens in Swift! 
Here's an alternate way that can be great in some situations:
class SomeTableView: UITableViewController, UITableViewDataSource {
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell = tableView.dequeueReusableCellWithIdentifier("abcd") as!  SomeClass
        cell.playSpecificAudioFile = {
            //Grab a specific audio file that corresponds with this specific cell, and play it
            //Since this is being written on the TableView, and not the Cell, 
            //you probably have access to all the data source stuff you need
            //and are much better suited to lining up the indexPath and dataSource here 
        }
        return cell
    }
}

private typealias PlaySpecificAudioFile = () -> ()

class SomeClass: UITableViewCell {
    private var playSpecificAudioFile: PlaySpecificAudioFile? 
    @IBAction func userDidSomething(sender: AnyObject) {
        playSpecificAudioFile?() 
    }
}

