Beginning iOS 10 Part 1 Getting Started - Part 2: | Ray Wenderlich

This video introduces you to the world of iOS and will walk you through the process of making a game from the ground up.

This is a companion discussion topic for the original entry at

I am having trouble with Xcode; it returns a “Could not insert new action connection” message when I try to establish a new action connection between storyboard and the view controller.

Here is what the error message looks like.

mine worked using
@IBAction func tappedRed(sender: AnyObject) {
view.backgroundColor = UIColor.redColor()
@IBAction func tappedBlue(sender: AnyObject) {
view.backgroundColor = UIColor.blueColor()
@IBAction func tappedGreen(sender: AnyObject) {
view.backgroundColor = UIColor.greenColor()

says cannot find ‘UIcolor’ every time i type .red .blue .green

Hey guys,

For the error “Could not insert new action connection” - Make sure that you do not have any other actions referencing to the view controller. Here is a great link to solve your problem.

@pdenlinger - Interesting how yours did not work using the .red .blue .green properties on UIColor. This is my code and it ran fine.

@IBAction func blueBackground(_ sender: Any) {
    view.backgroundColor =

@IBAction func greenBackground(_ sender: Any) {
    view.backgroundColor =

@IBAction func redBackground(_ sender: Any) {
    view.backgroundColor =

My solution using a single function and a switch statement:

class ViewController: UIViewController {
@IBAction func changeColor(_ sender: UIButton!) {
    let currentSelection = sender.currentTitle!
    switch currentSelection {
    case "Red":
        view.backgroundColor =
    case "Blue":
        view.backgroundColor =
    case "Green":
        view.backgroundColor =
        print ("Error")