Swift

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

Swift array map() method: Tutorial & examples

Updated: April 19, 2023 By: Khue

Overview In Swift programming, the array map() method is used for transforming an array by applying the same operation to each element of the array using a specified…

Swift: 3 ways to calculate the average of a numeric array

Updated: April 19, 2023 By: Khue

This practical, example-based article walks you through a couple of different approaches to calculating the average (the mean) of all elements in a numeric array (an array that…

Swift: 5 ways to find the sum of a numeric array

Updated: April 18, 2023 By: Khue

This practical, code-centric article will walk you through several different ways to calculate the sum of a numeric array (an array that only contains numerical elements) in Swift….

Swift: Find the index of a specific element in an array

Updated: April 18, 2023 By: Khue

Overview Swift provides several built-in array methods that can help you find the index of an element (when knowing its value or some of its characteristics) in a…

Swift: 3 ways to reverse an array

Updated: April 18, 2023 By: Khue

When developing applications with Swift, there might be cases where you need to reverse a given array, such as when you want to display an array of messages…

Swift: 2 ways to get the type of a variable at runtime

Updated: April 18, 2023 By: Khue

This succinct, practical article will walk you through a couple of different approaches to determining the data type of a variable at runtime in Swift. Without any further…

3 Ways to Concatenate Arrays in Swift

Updated: April 17, 2023 By: Khue

In the context of programming, concatenating arrays means joining two or more arrays into one array. This succinct example-based article will walk you through a couple of different…

Working with the insert() method in Swift

Updated: April 17, 2023 By: Khue

Overview In Swift, the insert() method has 2 variants: insert(_:at:) and insert(contentOf:at:). insert(_:at:) insert(_:at:) is used to insert a single element at the specified position in a given…

Swift: How to append elements to an array

Updated: April 17, 2023 By: Khue

Using the append(_:) method Appending elements to an array means adding new elements at the end of the array. You can do that in Swift by using the…

Swift: How to find the length of a given array

Updated: April 17, 2023 By: Khue

This short and straightforward article shows you a couple of different ways to find the length of a given array in Swift. The easiest approach is to use…

1 3 4 5 6 7