Muhammad Harits Syaifulloh

Friday, September 16, 2016

Swift 3 - Setting Up The Playground

Swift 3 Tutorial - Setting Up The Playground

Hi guys, welcome back to Ask MHS in Swift 3 Tutorial. In this section we will learn about swift 3 using Xcode 8 downloaded from Official Developer Site of Apple.

There's a great feature available inside of Xcode and it's called a Playground. A Playground lets you experiment with lots of code with Swift or Objective-C and it's a great way to understand what's going on with your swift code because you don't have to overhead of compiling the code so it run on a device or simulator.

When Xcode opened you should be presented with a screen that give you a view option. The first option is to get started with a Playground, if you can't see that simply go up to the menu File >> New >> Playground (such as the following picture):


After that you will be asked to type the name of your Playground and choose what platform that will be used. In this case I'll begin with an iOS platform and I'll give the first Playground project name with MyPlayground. Than save it wherever you want.
Okay, it doesn't really matter wherever you save it and after that, the playground comes finished with two commands already such as the following picture:

The first is import UIKit. UIKit as you imagine takes care of the user interface elements of our app, and it's a way for us to access the internal workings of all of the classes that Swift provides us with.

Then we have another line which is simply the decoration of a string called "Hello Playground". So this middle section is where you code sits.

Over the right-hand side is a light gray box that will notice you about the result of your code. It has "Hello Playground", and it's simply repeating to us what our string is. And on the right-hand side of that text we have an eye, so we can hit quick look and it gives us a more complete picture of it in case that text was very long. Then we also have a plus icon which show result underneath and we can get rid of that.



So expand that right-hand pane because it's going to come in very handy for the rest of this module.

Alright guys that's about setting up the Playground. Hope it will easier for you in learn more about swift 3 and iOS development. Thank you very much and see you next time in the next tutorial.

No comments:

Post a Comment