Closures, Extensions and Generics in Swift

Closures Closures are self contained lines of code that can be passed around the application and similar to blocks in Objective-C. A typical closure syntax in Swift looks as shown below Closure Syntax { (parameters) -> return type in statements } Example closure in Swift var greetings = { (name:String, message:String) -> (String) in message […]

Class and Struct in Swift

Download the playground file from github (Classes and Struct) Class A class is a blue print for a real-word entity such Player, Person etc. and it is used for creating objects. Class can have properties to store values and methods to add behaviour. Let us see this with an example class called Rectangle which has […]

Tab Bar Controller with WebView

In this article, we will see step by step instruction on working of Tab Bar Controller, UIWebView and Activity Indicator by loading couple of web pages using UIWebView in two different Tabs. Tab Bar Controller Tab Bar Controller is used for organising list of View Controllers by having seperate tabs for each View Controller. Check […]

CoreData tutorial in Swift 5 using NSFetchedResultsController

Let us see an example TaskManager app using CoreData written in Swift Programming language. This app provides the following functionality Allow users to enter new task Update existing task delete task You can download source code for this project from Github. If you are familiar with user interface then move on to the Core Data […]

Get your current address in Swift (Swift 5)

In this Swift tutorial, we will see the steps required for using CoreLocation framework and retrieve the latitude and longitude of the location. Then use the CLGeocoder to reverse geocode the latitude and longitude details. This is a very basic tutorial that retrieves the location details on tap of a button and displays the information […]

Swift – WebView demo

Updated for Swift 5In this short tutorial, we will see an example in Swift programming language using UIWebView. The WebView will load a webpage and provide option to refresh, stop, go back and go forward. This tutorial should give a brief overview on how to declare IBAction, IBOutlets and use Objective-C classes (NSURL and NSURLRequest) […]

Auto Layout in iOS

Using Auto Layout feature developers can align UI controls for different devices, screen sizes and orientation. This reduces the code to be maintained and makes life easy for the developers. Auto Layout solves UI design issues by creating relationship between the UI elements. This follows constraint based layout system where you can define contraints for […]

Access Control in Swift

Swift like other programming languages provides option to restrict access to classes, functions, variables, structs, enums etc applying the required Access Control. These restrictions are based on each module, as per Apple documentation a module is defined as A module is a single unit of code distribution—a framework or application that is built and shipped as a […]