swift

swift

Find the maximum of n values using max() in Swift

In this post, we will learn how to use the max() function with different examples. We will use it to find the maximum of n different values.

Read
swift

Find the smallest of n values using min() in Swift

In this post, we will learn how to use the min() function with different examples. We will use it to find the minimum of n different values.

Read
swift

Swift program to find the smallest of three numbers

Three different ways in swift to find the smallest of three numbers. We will learn how to find the smallest value by using a separate function and by using min function

Read
swift

3 Swift programs to find the largest of three numbers

Three different ways in swift to find the largest of three numbers. We will learn how to find the largest value by using a separate function and by using max function

Read
swift

How to convert a string to float and double in Swift

Swift program to convert a string to float and double. We can use floatValue, Float constructor, doubleValue or Double constructor to convert a string to float or double in swift.

Read
swift

How to return multiple values from a function in Swift

Swift program to return multiple values from a function. We can return multiple normal values or multiple optional values from a function.

Read
swift

How to insert characters to a string in Swift

Swift program to insert characters to a string. This post will show you how to insert single or multiple characters to a swift string.

Read
swift

2 ways to find the first and last character of a string in Swift

Swift program to find the first and last character of a string in swift in two different ways. We can use first, last properties or startIndex, endIndex to find the first and last character of a swift string.

Read
swift

How to find the maximum or largest element in a swift array

Swift program to find the maximum or largest element in an array. We can use max or max(by) to find the largest array value. In this post, I will show you how to use max and max(by) with examples.

Read
swift

Swift program to convert a string to date

Swift program to convert a string to date. We can use a DateFormatter class to convert a valid string to a Date object in Swift. We can use define different formats in the DateFormatter class.

Read