Swift

Everything about the Swift programming language, from basic to advanced, from simple to complex

Swift Array contains() method

Updated: April 30, 2023 By: Khue

Overview The array contains() method in Swift is a method that checks whether an array contains a specific element or not. This method has two variants. Value version:…

Swift: 3 Ways to Get a Random Element from an Array

Updated: April 29, 2023 By: Khue

When developing iOS apps (or other types of apps for Apple devices), there might be times when you need to retrieve a random element from a Swift array,…

Swift reduce() method

Updated: April 29, 2023 By: Khue

Prologue Swift is a modern, powerful, and expressive programming language that has become the go-to choice for iOS development. One of the key features of Swift is its…

Working with Multidimensional Arrays in Swift

Updated: April 28, 2023 By: Khue

Overview In Swift, a multidimensional array (also known as a nested array or an array of arrays) is an array that contains other arrays as its elements. Some…

Slicing Arrays in Swift: From Basic to Advanced (with Examples)

Updated: April 26, 2023 By: Khue

This succinct, practical article covers everything you need to know about array slicing in Swift. What is array slicing and why do we need it? Array slicing is…

5 Ways to Remove Elements from an Array in Swift

Updated: April 26, 2023 By: Khue

As an iOS developer who works with Swift almost every day, you will frequently encounter situations where you need to manipulate arrays to achieve desired results. Removing one…

Sorting Arrays in Swift: Tutorial & Examples

Updated: April 26, 2023 By: Khue

Overview Array sorting is the process of arranging elements in a specific order – either ascending or descending. Swift provides several built-in functions to sort arrays, allowing developers…

Swift: 4 Ways to Shuffle an Array

Updated: April 19, 2023 By: Khue

Shuffling an array means randomly re-arranging the elements of that array. This example-based, practical article will walk you through several different ways to shuffle a given array in…

Swift: 3 Ways to Swap 2 Elements in an Array

Updated: April 19, 2023 By: Khue

Swapping 2 array elements means exchanging their positions in the array. For example, if you have an array like [1, 2, 3, 4] and you want to swap…

Swift array filter(): Tutorial & examples

Updated: April 19, 2023 By: Khue

The Fundamentals In the realm of Swift, the array filter() method is used for returning a new array that contains only the elements of the original array that…

1 2 3 4 5 6 7