
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

7K+ Views
In Swift, you can use the built-in Data type and its method base64EncodedString() to encode a string to Base64. In the iOS applications, you might need to encode a string to base64 mostly in networking requests and responses. Mostly, you will need to encode a string to base64 and vice versa. Let's learn how to encode a string to Base64 using Swift. Example In this example, we will use the following steps to encode a string to base64 − Step 1 − In this step, we will convert the string to a Data object using the data(using: .utf8) method. ... Read More

4K+ Views
In iOS app development, it is common to find the index of a character in a string. Based on the given index, you can perform different actions. In this article, you will see some examples of how to get the index of a character using the below functions − firstIndex(of:) firstIndex(where:) range(of:) All the above methods can be performed on a string value in different use cases. Using the FirstIndex() Method In Swift, you can use the firstIndex(of:) method to find the index of a character within a string. Here's an example −Example let inputString = "The quick ... Read More

11K+ Views
Swift provides a class called JSONSerialization to convert a dictionary to a JSON string. We will use the two steps to convert a dictionary to a JSON string in the Swift language. Here are the steps − Convert a dictionary into JSON data format using JSONSerialization.data() method which takes a dictionary object as a parameter along with the options. Now using the String(data:encoding:) constructor, convert the JSON data into JSON string format. In this article, you will see some examples of how to convert a dictionary into a JSON string. JSONSerialization The Foundation framework for iOS and ... Read More

854 Views
To remove an object by value from an array in Swift, you can create an extension to the Array type. You can then call the function that takes the value to eliminate as a parameter. In this article, we will use the filter function to remove an object passing by value in the Swift language. Let's see some examples of how you can eliminate an object by value from an array Example 1: Remove an Object Using the Filter Function You can use the built-in filter method to create a new array without the matching value. Algorithm Step 1 ... Read More

4K+ Views
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, this is true in this method. The following example shows how to dismiss a UIViewController screen in Swift. First view controller setup In this step, we will set up the first view controller to present the second view controller. We will add a button to the first view controller, which ... Read More

2K+ Views
In the iOS applications, the UIImageView class does not provide in-build support to make it clickable like other components e.g. UIButton. In order to make UIImageView clickable, you can add a UITapGestureRecognizer to the image view. Remember that, by default, UIImageView does not take any interaction from the user. To make it interactable, set true to the isUserInteractionEnabled property. In this article, you will learn how you can add a tag gesture to the image view in Swift. To add a tap gesture, we will follow these steps − Step 1 - Create an Image View let profileImageView = ... Read More

10K+ Views
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. We will use them to apply the gradient to a view. In last, we will use the insertSublayer method to add the gradient layer to the super view. To apply a gradient to the background view of an iOS Swift app, you can follow these steps − Step 1 - ... Read More

2K+ Views
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 in the text field. It is also possible to add multiple text fields. In this example, we will use the following steps to get input values from the text field in iOS. Basic Setup In this step, you will add a button object to the controller's view to present the ... Read More

2K+ Views
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 article, we will move the text field when the keyboard appears with the following steps. Step 1 - Basic setup In this step, we will do some basic setup by adding a text field to enter the email address. We will add the text field at the bottom of the ... Read More

2K+ Views
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 will set up two different view controllers to see the default behavior of the back button and how to set the custom back button text. First View Controller Setup In this step, we will set up the first view controller to push the second view controller. Here is the code ... Read More