Blog

In this tutorial, you will learn how to create a console-based Spring Boot application that you can run in the terminal window on your computer. You will also learn to pass command-line arguments to your Spring Boot console-based application. For more Spring Boot tutorials and video lessons check this page: Spring Boot tutorials and video lessons.…

Read More Spring Boot Console Application

Maven is a build automation tool that is primarily used for Java projects. It provides a set of conventions for building and managing projects, making it easier to manage dependencies, build processes, and project configurations. Maven automates many of the tedious tasks associated with building and managing Java projects, such as compiling source code, creating…

Read More How to Install Maven on Mac OS

In this tutorial, you will learn how to send HTTP Post Request in Swift and how to read HTTP Response and Response Body. This tutorial will cover: Send HTTP Post Request, Convert Query String request parameters to JSON, Convert Swift structure to JSON, Set HTTP Request Headers, Read HTTP Response, Read HTTP Response Headers, Read HTTP…

Read More HTTP POST Request Example in Swift

In this short tutorial, you will learn how to add Biometric Authentication to your iOS app built with Swift. iOS devices starting from iPhone 5S until iPhone 8 Plus will use Touch ID for biometric authentication, while devices starting from iPhone X and above will use Face ID for biometric authentication. Update Info.plist File To be…

Read More Touch ID or Face ID Authentication in Swift

In this short tutorial, you will learn how to convert JSON string to a struct or a class in Swift. JSON String Let’s assume we have a web service endpoint which returns us a JSON string containing the following user details: {“firstName”:”Sergey”,”lastName”:”Kargopolov”,”email”:”[email protected]”,”userId”:”7fc0631b-7116-4d41-8d87-78f97b4dc543″} Swift Data Structure. Conforming to Codable or Encodable. We need to write Swift code…

Read More Convert JSON to Swift Class or Struct

This page contains different code snippets on how to work with Dictionary in Swift. Create Empty Dictionary // Create an empty dictionary let myDictionary = [String:String]() // Another way to create an empty dictionary let myDictionary2:[String:String] = [:] // Keys in dictionary can also be of type Int let myDictionary3 = [Int:String]()   Add Item…

Read More Working with Dictionary in Swift. Code Examples.

In this very short Swift tutorial, you will learn how to loop or iterate over a dictionary in Swift and print out key/value pairs. Loop Through Dictionary // Create a Dictionary with two elements var myDictionary = [“first_name”: “Sergey”, “last_name”: “Kargopolov”] // Loop through dictionary and print key/value pair for (key,value) in myDictionary { print(“\(key)…

Read More Loop Through Dictionary in Swift

In this Swift tutorial, you will learn how to use the flatMap function in Swift which will flatten an Array of Arrays into a single array of elements. Given an Array of Arrays Let’s consider the following Array of Arrays. let numbers = [ [1,2,3,4], [5,6,7,8], [9,10,11,12]] The above array contains 3 arrays of integers. We…

Read More How to Use flatMap in Swift. Code Examples.

In this short Swift tutorial, you will learn how to use one of the High Order Functions in Swift called map(_:) to apply a transformation to each element in an Array. Given an Array of Names Let’s consider an Array of String values: let names = [“sergey”, “michael”, “john”, “bill”, “tom”] All values in this Array…

Read More How to Use map(_:) in Swift. Code Examples.

To practice Swift programming and learn how to create and position UI elements programmatically in Swift you can use Xcode to create a new project or you can use Xcode Playgrounds. In this short tutorial, you will learn how to use Xcode Playgrounds to run Swift code that creates a new UIView with a single…

Read More How to Use Xcode Playgrounds to Create UI in Swift

The below code example in Swift demonstrates how you can extend classes in Swift. Extending Class in Swift As an example, let’s learn how we can extend class Int.  Create a new Swift file in your current project and add there the following extension with a function that substructs a value. extension Int { func…

Read More Extending Classes in Swift. Class extension.

The below Swift code example demonstrates how to implement the Singleton Design Pattern in Swift. Singleton Design Pattern guarantees that only one Object of a class exists in the system even if a developer attempts to create multiple instances of it. Singleton Class example in Swift // Creating Singleton // Only one instance of this…

Read More Singleton Class in Swift. Code Example.

In Swift, a class or a struct can have multiple initializers which are used to create an instance of that particular type and set up its initial state. The code examples below show how to define a class with single or multiple initializers and how to create an instance of that class. Single Initializer class…

Read More Swift Class with Single and Multiple Initializers