Author: Sergey Kargopolov

Software developer

Web: www.appsdeveloperblog.com

When writing unit tests, developers try to follow the F.I.R.S.T principle as much as possible. F.I.R.S.T is a combination of multiple principles. Let’s learn what these are. Fast The first letter in the F.I.R.S.T principle stands for – Fast. Unit tests are small pieces of code that perform one, specific task. Because unit tests are…

Read More The F.I.R.S.T. Principle in Unit Testing

The addTeardownBlock(_:) runs right after the test method ends and before the instance’s tearDownWithError() method is called. Below is an example of a TestCase class that does not test anything and only demonstrates the order in which the setUp() and tearDown() methods are called. When will the addTeardownBlock(_:) run? The addTeardownBlock will run after the test method is…

Read More addTeardownBlock Example in XCTestCase

In this tutorial, you will learn how to read user current location(latitude and longitude) and also how to listen for location updates continuously. Configure Info.plist To make your iOS app be able to read the user current location, it needs to prompt a user for permission to do so. The user will see an alert dialog…

Read More Determine User’s Current Location Example in Swift

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 create both a one-dimensional and multidimensional arrays in Swift. After reading this tutorial, you might also be interested in learning how to use FlatMap and Map when working with arrays. How to Use flatMap in Swift. Code Examples, How to Use map(_:) in Swift. Code Examples, Ways…

Read More Multidimensional Array Example in Swift

In this tutorial, you will learn how to create a UICollectionView programmatically in Swift. You will learn how to create a new UICollectionView with UICollectionViewFlowLayout and will learn how to make it display a few cells. You will also learn how to make your UIViewController conform to a UICollectionViewDelagate to handle events when user taps on…

Read More Create UICollectionView Programmatically in Swift

In this tutorial, you will learn how to create an instance of @LoadBalanced RestTemplate and make it communicate with an internal microservice. For a step by step series of video lessons, please check this page: Spring Boot Microservices and Spring Cloud. Create RestTemplate Bean To create an instance of RestTemplate, you will need to first…

Read More @LoadBalanced RestTemplate Call Internal Microservice

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