Author: Sergey Kargopolov

I’m a software developer with a passion for teaching. I’ve written lots of articles for AppsDeveloperBlog.com and made plenty of video tutorials on my YouTube channel(https://youtube.com/@SergeyKargopolov). If you want to dive deeper, I’ve also got some courses on Udemy(https://www.udemy.com/user/sergeykargopolov/) you might like.

When I’m not coding, I love to travel. I also share my travel adventures over at TravelLocalCanada.com. Hope to see you around on one of these platforms!

Web: www.appsdeveloperblog.com

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

I recently had to work on with one AWS service and to follow it’s getting started tutorial they invited me to use the CLI command-line interface which would configure a service for me. The CLI tool failed to configure the service itself and it did actually clear the existing ~/.aws/credentials file for me 🙁 which…

Read More Create .aws/config and .aws/credentials Files Manually

Docker is an amazing tool that simplifies the deployment process of software applications in containers. Containers allow a developer to package up an application with all the parts it needs, including libraries and other dependencies, and ship it all out as one package. This article provides a comprehensive cheat sheet to Docker commands, explaining what…

Read More Docker Commands Cheat Sheet

This tutorial will teach you how to run RabbitMQ in a Docker container. If you do not use Docker, you can download RabbitMQ Server to your computer. To learn more about Docker, please check Docker Tutorials page. Run RabbitMQ Using Image from Docker Hub RabbitMQ docker image is available on Docker Hub. If you have…

Read More How to Run RabbitMQ in a Docker Container?

In this tutorial, you will learn to create a Docker image for your Spring Cloud Config Server, which uses Symmetric or Asymmetric encryption to protect sensitive information. To learn how to create Spring Cloud Config that uses Symmetric encryption, read Spring Cloud Config – Symmetric Encryption and Decryption(Includes Video tutorial). And to learn how to create Spring…

Read More Docker Image for Spring Cloud Config Server

In this tutorial, I will share with you how to secure Spring Cloud Eureka dashboard with Spring Security. To learn how to build RESTful Microservices with Spring Cloud by watching step-by-step video lessons, please check this page: Spring Boot Microservices and Spring Cloud. Add Spring Security to Eureka To secure Eureka with Spring Security, we will…

Read More Secure Eureka Dashboard with Spring Security

If a requested Microservice takes long time to respond, Zuul Api Gateway might timeout and a Gateway timeout error will take place. { “timestamp”: “2019-05-24T00:53:22.152+0000”, “status”: 504, “error”: “Gateway Timeout”, “message”: “com.netflix.zuul.exception.ZuulException: Hystrix Readed time out” } In this short blog post I am going to share with you how to make your Zuul Api…

Read More Zuul API Gateway Timeout Error