Author Topic: Important: Chapter 12 - conditional statements  (Read 5986 times)


  • Newbie
  • *
  • Posts: 7
    • View Profile
Important: Chapter 12 - conditional statements
« on: October 12, 2015, 11:22:42 AM »
I found a small bug in the Conditional Statements project.

After you type in code for a capitalized String, the compiler will flag an error: no such member of the string array.

To fix it, go to near the top of the ViewController.swift file. Right under the @IBOutlet declarations, go into the choices array:

var choices = ["Upper Case", "Lower Case"] and add "Capitalized" to the array definition, so the array will now look like this:

var choices = ["Upper Case", "Lower Case", "Capitalized"].

so now "capitalizedString" will be a member, and the error message goes away, and you'll see the option in the iOS simulator.


  • Global Moderator
  • *****
  • Posts: 25
    • View Profile
Re: Important: Chapter 12 - conditional statements
« Reply #1 on: July 14, 2016, 06:18:51 PM »
After working through that specific exercise in Chapter 12, I didn’t get any errors so it doesn’t appear to be a bug.  The fix you mentioned, which is to add “Capitalized” to the choices array, is listed as Step #2 on page 198.  I recommend walking through the steps again from the beginning of the chapter to see if it happens again.  If so, please let me know.  Thank you.

Oak Leaf Enterprises, Inc.