0
votes

Completely new to Xcode for iOS development and my syntax is responding an error to certain things like declaring a range

  for num in 0..15 { 
       println(num) }
   }

This gives me an error. The only difference I saw is that I am importing UIKit instead of Cocoa like all the tutorials.

When I import Cocoa instead I see another error which is this.

  Playground execution failed: swift_app.playground:3:8: error: no such module 'Cocoa'

All that I changed was:

import UIKit  

to

import Cocoa

How do I have a working playground that responds correctly to import Cocoa?

1

1 Answers

4
votes

You should only import Cocoa if you're working on code for OS X. UIKit is only for iOS so it sounds like you created an iOS playground. If you want to use Cocoa to follow a tutorial create a new playground and select OS X from the menu.