Chapter 5 - Swift Playgrounds

  • Swift Playgrounds helps you learn and explore coding in Swift.
  • Swift Playgrounds can satisfy your curiosity about what coding is and how it works, but it doesn’t really let you write apps.
  • In Swift Playgrounds you create small programs called “playgrounds” that instantly show the results of the code that you write.
  • Playgrounds are a great way to try some code and see the results immediately.
  • Steps to create a Swift Playground
    1 - Launch Xcode
    2 - Click on Getting Started with a playground.
    Xcode Priya Talreja
    3 - You’ll see a list of playground templates you can choose from, but for now we’re going to choose Blank.
    SwiftPlayground Priya Talreja
    4 - Finally, Xcode will ask you to name your playground – the default name is "MyPlayground", you can give whatever name you want.
    SwiftPlayground Priya Talreja Swift Tutorials
    5 - Click Create.

After playground is created, you'll see is a window split in two.

  • Left panel is for the code.
  • Right panel is for results.

SwiftPlayground Priya Talreja Swift Tutorials

On the right, once Xcode has built and run the code, you'll see this: "Hello, playground".

My next blog will be on Variables and Constants.

Priya Talreja Xcode Tutorials
Please let me know if you have any doubts or queries in the comment section below.
Follow me @priyatalreja to get the latest feeds of iOS App step by step development tutorials.
Thanks.