In this article, We will make a Widget for an iOS Application. To start with, We need to answer ourself few questions:

  1. What information we are going to display in Widget ?

Once you are ready with answers, Start making one with below steps. Even if you are not sure of above questions, Start right away. You can answer by end of this article.

Add new Target to your project

Like any other extensions, Widget is also an extension to our application. …

Photo by Brett Jordan on Unsplash

Identity of View plays important rule in managing SwiftUI Views lifecycle. Each View has its own identity. It can be explicitly given or taken from structural placement .

In UIKit/APPKit, each view has pointer identity since they are reference types.

Photo by Sergio Ibannez on Unsplash

WWDC is a favourite week for iOS Developers which brings huge advancements to APIs used by them in regular life. Apple also released beta versions of iOS, iPadOS, watchOS, tvOS and MacOS

But the advancements is for a year not just for one week. The sessions came online this week. That doesn't mean we have to be confident on all advancements. Anyhow, there is good time to upgrade your app with these advancements.

Plan Of Action

It is not bad having some plan or schedule.

Swift Concurrency

Before WWDC I re-visited all the basics and especially Dispatch Queues, closures and Combine. Concurrency in swift got…

Photo by Tamanna Rumee on Unsplash

When your app has some unique file to handle and you feel creating custom file extension or adding the custom file extension created by another developer that suits your needs then follow this article to make it possible.

Before going straight away to the procedure/steps, let us understand the Uniform Type Identifiers in iOS development.

Uniform Type Identifiers

Uniform Type Identifiers carries identity of your documents or files across the system. UTI tells system what apps can handle that particular document. For example when you try to open image, you can see various supported applications under ‘Open With’ in finder.

In the same…

Photo by Mae Mu on Unsplash

Unlike many other languages, Enums in swift are very powerful. But we usually limit the usage of enums for few spots such as custom error type and representing different states of object.

Enums is basic value type used very commonly in iOS development. In this article, we will use enums in some uncommon but plausible use cases.

Overloading Cases

Associated values are biggest asset of enums. It is good to keep in mind that we can overload the cases by varying associated values. Here is simple example:

enum Role {  case artist  case developer  case director  case custom(String)  case custom(name: String)}

Test Equality

Photo by Dennis Brekke on Unsplash

Swift has large number of functions that can be readily used in iOS development. contains() and filter () in swift are useful when we need to search if a number exists in list and filter list based on a condition respectively.

In some scenarios these functions cannot be used as such. One such scenario is searching strings(functionality of search in contacts). Searching in contacts takes keyword/keywords and searches for them in every contact first name or last name i.e., search where order doesn’t matter.

We will extend Array to use contains and filter in searching and filtering an array where…

Photo by Mika Baumeister on Unsplash

Strings in swift are very commonly used by iOS Developers. We solve variety of problems in our development with the power of strings. But we generally overlook some of important functions in strings. In this article I try to collect such functions and add some extensions possibly.

Separate substrings from string

In development we come across reading csv files and separating tags entered by user. In these scenarios we need to create an array of strings from a string separated by some separator. ‘components’ function in swift can be used here.

let res = str.components(separatedBy: ",")

output is array of strings which are separated…

Photo by Mohamad Mahdi Abbasi on Unsplash

Before writing the custom functions, let us re-visit the available inbuilt functions which are comparatively less used but powerful.

Range Operator As Index

we can use open range or closed range operator to access and modify elements inside array. If the array can't accommodate change then it will throw error.

var array = [1,2,3]array[0…1] = [2,2]
print(array[0..4]) // error: Index Out Of Range


enumerated() will return a pair which has index and element in each iteration.

array.enumerated().forEach({print(“\($0) -> \($1)”)})


Compare each and every element inside two arrays based on index and return true only if all elements at respective indexes are equal. …

Photo by Jungwoo Hong on Unsplash

Swift 5.4 and XCode 12.5 brought us some new features. With the latest version of Xcode, we can record videos and make animated GIFs. You can know the complete process here. Also with Swift 5.4 you can make functions with multiple variadic parameters and can overload functions locally.

In this article we will take the few advancements in swift 5.4 and apply in SwiftUI development.


ResultBuilders are used to build the new value with a customisable sequence.

During development with SwiftUI, I feel I could combine some of my Text Views and get a new combined Text View. …

With the release of Xcode 12.5(12E262), many new features rolled out. We will focus on an option to record video and GIF from simulator.

Previously there was workaround to record a video. But now you can do that directly from simulator.

Steps to record a video

  1. Run the code and launch the simulator.

4. Once you are done, Click on the record (red square inside white circle) button. Then recording video will be stopped and preview will appear.

5. After dismissing the preview, video…

Sai Durga Mahesh

Love playing with data

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store