Submitted by Faruque Ahamed Mollick

Posts by Faruque Ahamed Mollick

Array capacity in Swift

In this tutorial, you are going to learn about Array capacity property in Swift programming with the help of some examples. The capacity property in Swift returns the number of elements of the provided array without allocating any additional storage. Below is given the syntax of the array capacity property: array.capacity In the above syntax, […]

Load an image from URL in SwiftUI

In this SwiftUI programming tutorial, you are going to learn how to load a remote image from an external URL on the internet and show it in our app. SwiftUI already has AsyncImage that can download and then display the image from an URL. All we have to do is just passing the URL in […]

SwiftUI button trigger event handle

In this tutorial, you are going to learn how to handle an event action of a SwiftUI button when it is triggered by the user. We all know that users of Apple devices often have to interact with buttons inside the app in daily life. A common usage is to perform some action when click […]

Make SwiftUI image fit to screen keeping the aspect ratio

In this tutorial, you will learn how to make a SwiftUI image resizable to fit the screen keeping the actual aspect ratio. If we place an image in our app view using the SwiftUI Image() instance, then the result may not be as we expect. For a larger image, the image extends beyond the screen […]

Make HTTP Request in Swift

In this tutorial, I am going to show you how to make an HTTP request in Swift and fetch data from the URL. There are multiple ways to perform this task. But in this tutorial, we will focus in two different ways. Using URLSession class Apple provides us with the URLSession class to work with […]

Check if two strings are equal using elementsEqual() method in Swift

This tutorial will show you how to check if two strings are equal or not using the Swift elementsEqual() method. The Swift elementsEqual() method returns a boolean value. It returns true if the two string matches. Otherwise, it returns false. Below is how we can use the method: string1.elementsEqual(string2) In the above syntax, the string1 […]

Get the last N characters from a Swift string

This tutorial is going to show how to get the last N characters from a string in Swift. Here we are actually going to create another string by getting the substring that consists of the last N characters. The easiest way to achieve this task is by using the Swift suffix() method. The suffix() method […]

Get the nth character from a string in Swift

In this Swift programming tutorial, you are going to see how to get the nth character from a string. To get the character from the N position, we are going to use the index() method. This method will get the position index from our string by index number. Before describing further, let’s see the code […]

Get the first character from a Swift string

This tutorial is going to show you how you can get the first character of a string in Swift programming. There are four methods listed in this tutorial that can perform this task. Method 1: Using string first property This is the simplest way for getting the first character of a string. Below is the […]

Get the last character from a string in Swift

In this Swift programming tutorial, you are going to learn how to get the last character from a String. There are three methods I am going to show you that can perform this task. Method 1: Using the last property Using the last property is the simplest way to get the last character of a […]

| Next Page »