Objective: The main objective of this post is to describe that how to play with swift programming code in iOS. If you play with all code part with new swift language than you play here with on the spot output.
In this post, I’ll show you how you can easily write swift code and each & every line display output on the right side of the screen.
We will simply create a playground area for swift programming language implementation and check different type of things on the screen.
Following are the steps that give you a brief introduction about how to play swift code in playground.
First of all, you must have OS-X 10.9.4 version or later and Xcode-6 Beta version for swift playground.
Open up Xcode and create a playground with clicking on “Get started with a playground” which looks like:
After that, give your playground name and choose platform iOS or OS X doesn’t matter because we don’t interact with user interface and click next and save to your location Which looks like:
Here, left hand side white part is used as editor, here, you can write Swift program and right hand side gray part is used as view Result of your code. Here, one example is by default create for var str = “Hello, playground” and similarly, display result on right side.
Now, put some swift code for testing like if-statement, for-loop statement etc.:
Now, some swift code for for-loop statement execution on right hand side give results like 11 times loop executes and on that click on black dote open new part of screen like graph which is shown below:
In graph portion, you can easily understood process of for loop and also, execution time period by graph representation which looks like below.
After doing all these things, we conclude that for beginner of swift programmar playboard is most useful to know how each & every code works.
In playgound project, we can implement small part of code, which we want to check, and using this we are not handling whole project or entire structure only work with one file, which is myPlayground.playground file.
This post has been seen 545 times.