Swift

Swift provides powerful tools for comparing and equating custom objects using the Comparable and Equatable protocols. In this tutorial, we will explore how to use the Comparable protocol to compare custom objects based on their properties, and the Equatable protocol to determine whether two objects are equal. By the end of this tutorial, you will…

Read More Comparable Protocol: How to Compare Custom Objects

In this tutorial, you will learn how to create UISlider in Swift programmatically. UISlider is a UI control that is used to select a single value from a continuous range of values. Below is an image of UISlider control. Create UISlider Programmatically To create UISlider control programmatically, you need to create a new instance of…

Read More Create UISlider in Swift Programmatically

In this tutorial, you will learn how to add days, months or years to the current date in Swift. To work with dates I will use Date(), DateComponents() and Calendar objects. I will first get the today’s current date and then will use the DateComponents() to add to a current date another day, month or…

Read More Add Days, Months, Years to Current Date in Swift

In this Swift tutorial, you will learn how to encode UIImage data to Base64 string. To verify that the UIImage data was correctly encoded into the Base64 string, we will decode the Base64 string back into image data and will create a new UIImage using this data. Create UIImage Before I can encode existing image…

Read More UIImage Base64 Encoding and Decoding in Swift

In this Swift tutorial, you will learn how to make UIImageView corners rounded. To learn how to programmatically create new UIImage, add it to UIImageView and make it visible in your app, have a look at the following tutorial: Create UIImage and UIImageView Programmatically Create UIImage and UIImageView To make image corners rounded, I will…

Read More UIImageView Rounded Corners in Swift

In this tutorial, you will learn how to create UIImage and UIImageView in Swift programmatically. Add Image to Xcode Project For your app to be able to display an image, the image needs to be either added to your app bundle or loaded from the Internet using an image URL. For this tutorial, I will…

Read More Create UIImage and UIImageView Programmatically

In this tutorial, you will learn how to create, schedule and handle local alert Notifications using the UNUserNotificationCenter in Swift. Local Notification vs Push Notification One of the main differences between Local notification and a Push notification is that local notifications are created, scheduled and are sent from a user iOS device. Push notifications are…

Read More Local User Notifications with UNUserNotificationCenter

In this XCTest tutorial, you will learn how to write a unit test that will test if UIButton is connected to @IBOutlet and has @IBAction assigned. For this tutorial, I will create a Single View application project. I will use the default View Controller that XCode creates for all new projects and I will position…

Read More XCTest. Test if UIButton is Connected And Has Action