Category: ios

  • Tuples, Enums and Protocols in Swift

    Tuples in Swift allows user to assign group of values to a variable, constant and even return parameter of a function. In the below example, a employee constant is assigned Int and String values. And to access these parameters, we need to use .0 and .1 [code language=”swift”]let employee = (103, “Deepak”) employee.0 employee.1[/code] Now…

  • Swift Basics – Beginners Tutorial

    Swift Basics Swift is a programming language made by Apple. It’s used for making apps for iPhones, iPads, and Macs. It takes good points from older languages like C and Objective-C but is safer and has new, easy features. Variables and Constants Data Types Collection Types Arrays Dictionaries Operators Let’s break down these concepts into…

  • How to display line numbers in Xcode

    Listed below are the steps to display line number in Xcode editor window. This is quite useful when you are working in a ground and want to communicate the line number of statement to other members. Click Xcode menu option and select Preferences from the menu list In the Preferences window, click Text Editing tab.…

  • XCode Playground Overview

    Playground is an interactive work environment that allows you to see the values in the sidebar for the written code. As and when you make changes to your code the sidebar reflects the changed result. Listed below are some examples written using Swift language in Playground Sum of n numbers [code language=”swift”]var sum = 0…

  • Retrieve list of Twitter followers using Swift

    This article provides details about the the steps required to retrieve the followers in from your twitter account. You will learn the following by going through this article Use oAuth to retrieve bearer token. Retrieve twitter followers using API call. Last 20 followers name and profile image will be displayed in a tableview. Download the…

  • How to record and play sound in Swift

    In this tutorial, we are going to see the required steps to record and play sound in Swift Programming language using AVAudioRecorder and AVAudioPlayer Download source code from github (SoundController.swift) User Interface The user interface for this demo is simple with two buttons, one for recording and another for playing sound. Create corresponding IBAction and…

  • UITextFieldDelegate in Swift

    This is a beginners tutorial on UITextFieldDelegate in Swift. We are going to see how to use UITextFieldDelegate by writing a Simple Interest Calculator. Download the source code from here This calculator uses UILabels and TextFields for displaying and accepting amount and interest. We are going to use the UITextFieldDelegate method to navigate from “Principal…

  • SplitViewController example in Swift

    This is a beginners tutorial on SplitViewController using Interface builder with programming language as Swift. There are also some good articles available on SplitViewController, check them out as well – nhipster and whoisryannystrom. Create a new Single View Application. Choose Language option as Swift and provide a product name. Navigate to Main.Storyboard and select default…