O'Reilly logo

Mastering Swift 4 - Fourth Edition by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

iOS, tvOS, and macOS Playgrounds

When you start a new iOS or tvOS Playground, the Playground imports the UIKit framework. This gives us access to the UIKit framework that provides the core infrastructure for iOS and tvOS applications. When we start a new macOS Playground, the Playground imports the Cocoa framework.

What the last paragraph means is that, if we want to experiment with specific features of either UIKit or Cocoa, we will need to open the correct Playground. As an example, if we have an iOS Playground open and we want to create an object that represents a color, we would use a UIColor object. If we had a macOS playground open, we would use an NSColor object to represent a color.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required