Add a UITableView to an Existing ViewController in Xcode

Quick and dirty checklist for adding a table view to an existing view controller: Embed existing view controller in a NavigationController Drag a UITableView object into the view controller in the storyboard Make the UITableView the same width and height as the view controller and set the constraints to all four sides with no margins… Continue reading Add a UITableView to an Existing ViewController in Xcode

Create a Confirmation Alert in iOS with Swift

If you want to present an alert with an option to either take an action or cancel: @IBAction func clearImage(sender: UIBarButtonItem) { let alert = UIAlertController(title: “Clear Canvas”, message: “Are you sure you want to clear the canvas?”, preferredStyle: .Alert) let clearAction = UIAlertAction(title: “Clear”, style: .Destructive) { (alert: UIAlertAction!) -> Void in self.canvas.image =… Continue reading Create a Confirmation Alert in iOS with Swift