Apple introduced Swift Playgrounds, a new app to learn swift coding for iPad. It has been designed to make the learning of swift more interactive and fun.Swift can be described as the powerful programming language created by Apple and it is being used by the experts to build many world class apps. Swift Playgrounds app mainly focuses on making the learning process of Swift easier. With this effort, Apple has moved one step towards making the new generation learn and write Swift codes.
Swift Playgrounds has programming lessons where students can learn coding by sharpening their skills with many puzzles and challenges. Built-in templates are added in the app encourages the users to create real programs and share it with their friends using emails and even posting it online. These programming courses and training are highly useful for the students in learning the core coding concepts such as looping, functions, variables and many others. Students get the confidence of building the codes and ultimately ends up sharpening their skills. Developers and Educators also gets an option to use Xcode for creating their own challenges for the app.
Apart from lessons, Swift Playgrounds has a lot to offer an aspiring developer. It has been designed in such a way that developers can show their creativity alongside build and modify the codes whichever way they want. The real Swift code is being used in the Swift Playgrounds and this makes it easier for the developers to directly export the codes to Xcode, an integrated development environment (IDE) containing a suite of software development tools developed by Apple). Exported codes are then used to create programs for iOS and macOS. Empty Playgrounds documents and built-in templates are two options provides for the development and writing codes in Swift Playgrounds.
The multi-touch feature is supported in Swift Playgrounds app and with the help of this entire program can be created with only a few taps. It has been made pretty simplified as the editing can be done on a single tap with a pop-over keyboard, now color can be displayed only by choosing their codes. Dragging and dropping of code snippets saves the user time code and yet powerful enough.
Undoubtedly, Swift Playgrounds is here to make a difference and revolutionizing the way coding is done so far. It's preview released with the iOS developer preview and it will be available to use with iOS public beta in July. It is compatible all the later running iOS 10 apple products. The final version of Swift Playgrounds will be soon available in the apple store for free.
Getting familiar with Playgrounds fundamentals
To begin with, it is required to download XCode , an integrated development environment (IDE) containing a suite of software development tools developed by Apple for developing software for OS X, iOS, WatchOS, and tvOS. Now after downloading and setting up we are all set to code with Swift.
Xcode is free to download from App Store and it requires a Mac computer running OS X 10.9 or later. Once downloaded, open Xcode and select “Get started with a Playgrounds.”
Xcode has been empowered with Swift programming language,and it is a great place to explore and have fun with the codes. The playground has the feature of producing real-time code results and this makes it more interesting to work with. Apple has also come up with a very interesting comment for it, “a place where people can have fun” .
The editor looks very simple as it appeals everyone to play and have fun while writing codes. It has been made so simple that anyone could understand it very easily and quickly. It has been separated into two different panels, the left side is for writing and editing the codes while the right side shows the results of the codes.
Swift variables and constants
var are used to declare variables in Swift.
let is used to declare constants in Swift.
We should know some fun facts about Swift as it uses any Unicode character such as emoji’s , hanzi, katakana to declare it as a variable.
Swift is a very flexible language as it doesn’t require any type annotations to understand variable’s type. If a user wants he can declare variable type explicitly. This can be done by changing the variable declaration with .
Here we declare a string:
var greetings: String = "Hey!"
If we want to add something:
var greetings: String = "Hey!"
greetings = greetings + “listen”
This concatenates two words and generates output as “Hey! Listen”
We use println() for printing something to the console. The keyword is superfluous but it is necessary to know for an iOS app developer.
println(“It’s awesome to use Swift. M loving it!”)
Swift Playgrounds comes up with different ways to comment a statement in the code.
// This is a single line comment.
/* It’s gone …All the things writtenSeriously */
Leave a Reply
Your email address will not be published. Required fields are marked *