Nitin Aggarwal has Published 156 Articles

Add an element to an array in Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 03-Jan-2023 10:07:42

6K+ Views

In this article, you will learn how to add an element to an array in Swift. Before you begin to learn element insertion into an array, you will need to understand the type of array. Array Syntax // Declare an immutable array let arrayName: [valuetype] = [array element 1, array ... Read More

What is the difference between Static func and Class func in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 03-Jan-2023 10:04:13

9K+ Views

You will learn about the differences between static and class functions in this article. Many times, you might think they are the same thing, but that's not the case. Let's understand the difference between them. What are Static Functions? In Swift, a static function is a type of function that ... Read More

NSNotificationCenter addObserver in Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 03-Jan-2023 10:00:48

2K+ Views

The purpose of this article is to explain how an iOS application can send and receive change events using NSNotificationCenter. In an iOS application, you might need to send and receive events anywhere in the app. It may be useful to use the NSNotificationCenter class when you need to receive ... Read More

Swift: print() vs println() vs NSLog()

Nitin Aggarwal

Nitin Aggarwal

Updated on 02-Jan-2023 14:30:46

2K+ Views

In this article, you will learn about logging methods in the Swift language. You will also learn what the differences between them are. Debugging is the most common practice while writing code for an iOS application. It enables you to debug logic, code, errors, etc. Swift provides in-built libraries to ... Read More

What does "Fatal error: Unexpectedly found nil while unwrapping an Optional value" mean?

Nitin Aggarwal

Nitin Aggarwal

Updated on 02-Jan-2023 14:29:11

4K+ Views

This error is very frequent as you can see many times while writing code. Don't worry, you will understand this error in detail in this article. Before jumping to the cause of this error, let's understand what is optional in Swift. Optional Initially, when we receive a value from another ... Read More

Loading/Downloading an image from a URL in Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 02-Jan-2023 14:25:57

6K+ Views

In this article, you will learn how you can download an image from a URL in the Swift language. In the iOS application, image downloading from the image URL is the most common task. Apple provides us with a native library to download any data from any URL. There are ... Read More

How to find the index of a list item in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 02-Jan-2023 13:40:14

13K+ Views

Swift gives you some methods to perform on the collection type to get the index of a particular object. To find the index of an item in an array in Swift, you can use the firstIndex(of:) method of the Array type. This method returns the index of the first element ... Read More

How to add constraints programmatically using Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 02-Jan-2023 12:57:00

11K+ Views

The goal of this article is to explain how you can add constraints programmatically in the Swift language. To programmatically add constraints in Swift, you can use the NSLayoutConstraint class to define the constraints you want to add. Concepts That Will Be Used To Add Constraints Are The Following The ... Read More

How does one generate a random number in Apple's Swift language?

Nitin Aggarwal

Nitin Aggarwal

Updated on 02-Jan-2023 12:51:25

333 Views

This article will explain to you how to generate random numbers in the Swift language. There are some common situations when you need to generate random values in your iOS apps such as Simulating dice rolls. Shuffling playing cards. Create a unique ID for a user. The random value ... Read More

How do I get a reference to the app delegate in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 02-Jan-2023 12:39:40

2K+ Views

You should know what an AppDelegate is in Swift before jumping to how to get a reference to it. AppDelegate In an iOS application, the app delegate is the entry point for the application. Throughout the application, this object has been created once by iOS and is accessible in shared ... Read More

Advertisements