Nitin Aggarwal has Published 156 Articles

How to iterate a loop with index and element in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 14:25:38

410 Views

In this article, you will learn how to iterate a collection using a loop with an index and element in the Swift language. In this article, you will learn how to use the enumerated() method. In Swift, you can use the enumerated() method to iterate over the elements of a ... Read More

How to check if an element is in an array?

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 14:10:43

76 Views

This article will explain how you can check if an element exists in an array or not in the Swift language. There are several ways to check if an element is in an array in Swift − Using the contains method The contains(_:) method returns true if an array contains ... Read More

How do I shuffle an array in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 09:14:06

106 Views

In this article, you will learn how to shuffle an array in the Swift language. In Swift, you can use the shuffle() and shuffled() methods to shuffle the array elements. shuffle() The shuffle() method shuffles the elements of the collection in place, so the original array is modified. shuffled() If ... Read More

How do I make an attributed string using Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 09:10:50

221 Views

This article will explain how you can make an attributed string in the Swift language. What are the steps to apply different attributes to a string in Swift? In Swift, we use the NSAttributedString class to make an attributed string. In Swift, NSAttributedString is a class used to create and ... Read More

How do I change the font size of a UILabel in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 08:58:53

619 Views

You can change the font size of a UILabel in Swift by setting the font property of the UILabel to a UIFont object with the desired point size. Here is the code for the basic setup import UIKit class TestController: UIViewController { ... Read More

How do I add 1 day to an NSDate?

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 08:55:29

58 Views

In this article, you will learn how to add the number of days to a date in the Swift language. Many times, you might need to modify the date by changing some number of days, weeks, months, etc. Swift provides an in-built concept for adding a component to date. Let's ... Read More

Getting a "This application is modifying the autolayout engine from a background thread" error?

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 08:50:34

53 Views

In iOS development, this error frequently occurs while working on user interfaces. Also, you can reduce the chances of coming across this error if you write code carefully. Let's understand what this error is all about. It will help you to understand the reason behind this error if you read ... Read More

Get the class name of an object as a string in Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 07-Sep-2023 08:49:13

637 Views

This article will explain to you how to get the name of the class of an object in the Swift language. Swift provides us with a function called type(of:) to get the type of a value or the class name of an object. You can use the type(of:) function to ... Read More

Generate a UUID on iOS from Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 06-Sep-2023 18:14:04

410 Views

This article will explain to you what is the UUID in iOS and how to generate it in the Swift language. You will see some practical situations in which UUID is useful in the iOS application. What is UUID? A universally unique identifier (UUID) is a string of characters that ... Read More

ViewDidAppear is not called when opening the app from the background

Nitin Aggarwal

Nitin Aggarwal

Updated on 04-May-2023 13:00:46

821 Views

In Swift, the viewDidAppear method does not call when an application is opened from the background. In that case, you have to use the applicationWillEnterForeground method in the AppDelegate. In this article, you will see an example of how to perform an action when opening an app from the background. ... Read More

1 2 3 4 5 ... 16 Next
Advertisements