Running our first swift code

We will start by creating a new Swift playground. As the name suggests, a playground is a place where you can play around with code. With Xcode open, navigate to File | New | Playground… from the menu bar, as shown in the following screenshot:

Running our first swift code

Name it MyFirstPlayground, leave the platform as iOS, and save it wherever you wish.

Once created, a playground window will appear with some code already populated inside it for you:

Running our first swift code

You have already run your first Swift code. A playground in Xcode runs your code every time you make ...

Get Swift: Developing iOS Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.