swift

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
swift

Learn to iterate through the key-value pairs of a swift dictionary

This post will show you how to iterate through the key-value pairs of a swift dictionary. We will do it by using a for-in loop, using forEach and by using enumerated.

Read
swift

String Prefix methods in Swift explanation with example

String prefix methods in swift. Learn how to use string prefix swift method with example.

Read
swift

Swift program to check if two strings are equal or not

This post will show you how to check if two strings are equal or not in swift. We will learn ==, elementsEqual method and case insensitive comparison of two strings in swift.

Read
swift

Swift String interpolation in 5 minutes

Swift string interpolation tutorial with example. Interpolation is the process to insert variables, constants, expressions, and literals into a string.

Read