- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Nitin Aggarwal has Published 156 Articles
Nitin Aggarwal
515 Views
There is no single "best" practice for naming Swift files that add extensions to existing objects, but here are some commonly used conventions − Object Prefix Followed by Functionality String+Utilities.swift − adds utility functions to the String class Array+Sorting.swift − adds sorting functions to the Array class UIColor+Extensions.swift − ... Read More
Nitin Aggarwal
74 Views
In Swift, there are some different syntaxes to declare an empty dictionary. It is important to remember that all syntaxes produce the same result. In this article, you will see examples of how to declare an empty dictionary and define a dictionary in Swift. What is a Swift Dictionary? A ... Read More
Nitin Aggarwal
4K+ Views
In Swift, you can convert an enum value to a String through the rawValue property. This is if the enum has a raw value of type String. If the enum doesn't have a raw value, you can use the String(describing:) initializer to get a string representation of the enum value. ... Read More
Nitin Aggarwal
1K+ Views
In Swift, when you call a function that throws an error, you must either mark the function call with the try keyword or handle the error using a do-catch block. If you see the error message "Call can throw, but it is not marked with 'try' and the error is ... Read More
Nitin Aggarwal
1K+ Views
In Swift, there are several ways to check whether an index exists in an array. You can use startIndex, endIndex, the indices property, and the count property. In this article, you will see some examples of checking an index. Example 1: Using FirstIndex & EndIndex You can check if a ... Read More
Nitin Aggarwal
2K+ Views
In Swift, you can return multiple values from a function using a tuple. In this article, you will see different examples of how to use a tuple to return multiple values from a function. Here are some more practical examples of functions that return multiple values using tuples in Swift ... Read More
Nitin Aggarwal
1K+ Views
In Swift, there are many comparison operators to perform calculations and check different conditions. Less than or greater than operators are used to checking conditional statements. In this article, let's see how to use them with switch and if statements. Less Than or Greater Than the Switch Statement In Swift, ... Read More
Nitin Aggarwal
37 Views
In Swift, you can conform to the CustomStringConvertible protocol to provide a default name for each case in an enumeration. This protocol can be used to provide custom meaning as per the requirement. CustomStringConvertible CustomStringConvertible is a protocol in Swift that defines a single property, description, which returns a String ... Read More
Nitin Aggarwal
1K+ Views
In Swift, there are several approaches to removing the leading spaces from a string. There are some methods available like trimmingCharacters, drop, etc. You can also use the NSRegularExpression class to trim all leading spaces from a string. Using the trimmingCharacters() Method The trimmingCharacters(in:) method is a built-in method in ... Read More
Nitin Aggarwal
780 Views
In Swift, you can use higher-order functions to flatten an array of arrays. You can use a combination of joined(), reduce(), and flatMap() functions. Sometimes, you are required to merge multiple arrays into a single array. In Swift, you can easily do that using high-order functions. In this article, we ... Read More