Nitin Aggarwal has Published 84 Articles

How to dismiss ViewController in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 27-Mar-2023 15:48:51

In Swift, we have a dismiss method of the class UIViewController that can be used to dismiss a ViewController in Swift. In this method, a Boolean value is used as an argument. There is an argument in this argument that asks whether the dismissed controller should be animated. By default, ... Read More

How to Apply Gradient to the background view of the iOS Swift App?

Nitin Aggarwal

Nitin Aggarwal

Updated on 27-Mar-2023 15:46:00

In iOS, there is a class CAGradientLayer to apply gradient colors to views. In this article, we will look at how you can use the CAGradientLayer class to apply gradients to the background of a view in iOS. The CAGradientLayer class provides different properties like colors, locations, points, frame, etc. ... Read More

Get input value from TextField in iOS alert in Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 27-Mar-2023 15:37:45

Generally, we use UIAlertController to show an alert with a dismiss action button. But UIAlertController provides you with more flexibility to add UITextFields to the alert. Let's see some examples of different use cases. When you add a text field to the UIAlertController, you can take the input value entered ... Read More

Move the text field when the keyboard appears in Swift

Nitin Aggarwal

Nitin Aggarwal

Updated on 27-Mar-2023 15:34:04

In real iOS applications, most of the time you deal with UITextFields for taking various inputs. In order to make the text fields visible while editing, you can manage the constraints by updating them. To manage the constraints, you have to add observers for keyboard showing and hiding. In this ... Read More

How to stop unwanted UIButton animation on title change?

Nitin Aggarwal

Nitin Aggarwal

Updated on 27-Mar-2023 15:29:57

In iOS applications, you will often need to customize the button according to your requirements. When you add a button to the parent view, the button title is animated by default. But if you want to stop that default animation, you can use the custom button in UIKit. We will ... Read More

How to set back button text in Swift?

Nitin Aggarwal

Nitin Aggarwal

Updated on 27-Mar-2023 15:27:46

By default, a view controller shows the text "Back" with an arrow on the back button in iOS. But you can set a custom title and icon for the back button item. Let's see an example of how to set custom back button text in Swift. In this example, we ... Read More

What is the difference between a weak reference and an unowned reference?

Nitin Aggarwal

Nitin Aggarwal

Updated on 24-Mar-2023 10:03:57

Understanding iOS memory management is essential for iOS and macOS development. The concept of weak self and unowned self is challenging to understand, especially for beginners. ARC (Automatic Reference Counting) may have solved many problems for us. Swift still requires that you manage references a lot of the time when ... Read More

What is the 'some' keyword in SwiftUI?

Nitin Aggarwal

Nitin Aggarwal

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

The "some" keyword in SwiftUI is used to indicate that a type conforms with a protocol, but the exact conformance is not specified. The AnyView type, a type-erased view that can represent any view conforming to the View protocol, is commonly used in association with it. SwiftUI defines some View ... Read More

What is the 'open' keyword in Swift?

Nitin Aggarwal

Nitin Aggarwal

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

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

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

1 2 3 4 5 ... 9 Next
Advertisements