- Trending Categories
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
Ankita Saini has Published 319 Articles

Ankita Saini
393 Views
In a Swift dictionary, we can search for an element that is either a key or value with the help of contains() function. The contains() function will return a boolean value which represents whether the specified element(key or value) is found or not. Syntax dict.contains{$0.key == “KeyName”} Here, dict ... Read More

Ankita Saini
64 Views
In Swift, a dictionary is an unordered collection of key-value pairs. So, to replace the value of a key Swift provides bracket notation or subscript notations. Using this notation we can also add new key-value pair in the dictionary if the specified pair does not exist. Syntax dict[keyName] = “Value” ... Read More

Ankita Saini
189 Views
Sometimes a dictionary contains null values so to remove those null values Swift provides an in-built function named the filter() method. In the filter() method, we pass a closure which returns a boolean value indicating whether the key-value pair should be included in the resultant dictionary or not. Or we ... Read More

Ankita Saini
233 Views
In Swift dictionary, we cannot have duplicate keys but can have duplicate values hence in this article we will remove duplicate values from the dictionary. So for that, we use contains() function. This function checks if the dictionary contains duplicate values or not. If the dictionary contains duplicate values, then ... Read More

Ankita Saini
268 Views
In Swift, we can remove an element from the specified dictionary using the removeValue() function. This function removes the specified key and its associated value from the given dictionary. Syntax Dict.removeValue(forKey: key) Here, the key represents the key which we wanted to remove from the dictionary along with its ... Read More

Ankita Saini
71 Views
In a dictionary, to remove all the elements from the dictionary Swift provides an inbuilt function named as removeAll() function. It will remove all the key-value pairs from the specified dictionary. Syntax dict.removeAll() Here, dict is the dictionary. The removeAll() function does not take any parameter and removes all ... Read More

Ankita Saini
393 Views
A dictionary is an unordered collection in which data is stored in the form of key-value pairs. To print the keys and values of a dictionary Swift supports the following methods − Using for-in loop Using properties Method 1: Using for-in Loop To print keys and values of ... Read More

Ankita Saini
42 Views
To print even-length words we calculate the length of each word using the count property. Then we check if the length of the word is even or not. If yes, then we will print the word. Otherwise not. Input Str = “Learn Swift language” Output language Here the ... Read More

Ankita Saini
145 Views
In Swift, a dictionary is used to create an unordered collection in which the data is stored in the form of key-value pairs. So to print a dictionary we will use the following methods − Using for-in loop Using description property Method 1: Using for-in Loop In Swift, ... Read More

Ankita Saini
402 Views
A Swift dictionary is an unordered collection in which data is stored as key-value pairs. So to pass a dictionary as a function argument simply create a function with an argument of dictionary type and a dictionary, then pass it to the function at the time of function calling. Syntax ... Read More