Nitin Aggarwal has Published 156 Articles

What is the 'open' keyword in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:25:35

2K+ Views

In swift, we have three keywords - Open, Public, and Final keyword. All these three words have different properties that help us understand whether the code can be extended to another module or not making the code easy to reuse. We will learn about the keywords' properties in this ... Read More

What is a de-initializer and how is it written in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:21:42

109 Views

In this article, you will learn how and why to use a de-initializer in the Swift language. You will learn the concept of de-initializing using some examples. When a class instance is no longer required, Swift automatically calls a specific method called a deinitializer. It is utilized to carry out ... Read More

What Is a Completion Handler in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:19:10

12K+ Views

In swift, the completion handler is a block of code that is used to perform and handle the completion state of a task. For example, completion handlers are very commonly used in network requests using URLSession class. Basically, the completion handler is passed as a function argument and called when ... Read More

What does init() do in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:17:33

362 Views

The init() method in Swift is used to initialize the objects of a class. When an object is created using the function Object() { [native code] } of the class, it is automatically called and establishes the object's initial state. To offer customized initialization behavior, such as establishing default values ... Read More

What are the most effective ways of achieving concurrency in iOS?

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:14:09

2K+ Views

In iOS development, there are several techniques available to achieve concurrency, You will see different approaches in this article along with some examples. You will learn about Grand Central Dispatch and NSOperationQueue techniques with examples. What is concurrency in iOS? In iOS applications, you can adopt the ability to run ... Read More

What are the Adapter and Memento Patterns in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:13:31

215 Views

In this article, you will learn about both the pattern in the Swift language. Also, you will see what are advantages of using these patterns. You will see examples of how you can adopt these patterns in your projects. Using the adapter pattern, you can design a system that allows ... Read More

Using isKindOfClass with Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:12:23

569 Views

In this article, you are going to learn how to use isKindOfClass in swift with some different examples. It is required many times you need to check the type of a class to perform specific code accordingly. What is “isKindOfClass”? The isKind(of:) method can be used for checking the object ... Read More

Swift: Test class type in the switch statement

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:11:23

2K+ Views

In Swift, you can use the is keyword to test the class type of an object in a switch statement. Also, you will some examples of how to typecast an object to the expected type. Here is an example to test primitive data types In this example, you will check ... Read More

Remove the last character from a string in the Swift language

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:10:11

3K+ Views

There are several ways to remove the last character from a string. Let's see some examples of different methods. We will use the below approaches to remove the character from a string − Using the dropLast() method Using the substring(to:) method Using the removeLast() method Using the prefix(upTo:) method ... Read More

Reading a JSON file using Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 28-Feb-2023 13:08:43

9K+ Views

In this article, we will see some examples of how we can read the JSON file using JSONSerialization and JSONDecoder classes. Nowadays, these classes are used in most iOS applications to work with JSON files. You can use the JSONSerialization class to read the JSON file in the Swift language. ... Read More

Previous 1 ... 7 8 9 10 11 ... 16 Next
Advertisements