Hi, this is a #FastTip about decoding JSON with endless nesting. I found this question in the iOS devs community and decide to help. Hope it will be useful!
For decoding, we will use the Decoding protocol from Standard Swift Library
As you can see, the JSON can have every level of nesting as you need. For testing and applying for the work with endless process of anything, it is super useful to know about recursion.
A little trick here, that struct Object has parameter “sub_elements” with type Optional(Array of Objects). …
This article is a part of the design patterns post series. Design patterns, in general, are key to stop reinventing the wheel in most of the common developer challenges. I think that design patterns are great as a resource which can spend your time.
Here you can find a post about the difficulties of a variety of tutorials and courses, and there a gave a list of sharableknowledge and technologies which will be useful on any developer’s job and which you can apply to any platform and stack.
Facade is a structural design pattern that provides a simplified interface to…
The main goal of this article is to share my experience in formatting data. Most of the apps have to show date, time, list of data, or transform and display mass, angle, duration, area, speed, volume, energy, length, temperature, pressure, and other kinds of measurements. It is very important to display data in the right way with proper format, units, imperial or metric measurements, localized.
Generic code enables us to write flexible, reusable code. It helps us to avoid duplication and take our code consistent and more universal. I like statically typed languages like Swift because you need to understand where and how to use generics. In dynamically typed languages like PHP or Python, all functions work like generic code and you can put any variable of any type to function and wait on the result🤞. Of course, you can avoid unexpected work of function with some documentation like “this function works only with Int” and it works, but not ideally. In Swift, you need…
This exercise is a part of my Linked List topic.
You’re given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer, insert this node at the head of the linked list and return the new head node. The head pointer given may be null meaning that the initial list is empty.
Input Format
You have to complete the SinglyLinkedListNode Insert(SinglyLinkedListNode head, int data) method which takes two arguments — the head of the linked list and the integer to insert. …
This exercise is a part of my Linked List topic.
You are given the pointer to the head node of a linked list and an integer to add to the list. Create a new node with the given integer. Insert this node at the tail of the linked list and return the head node of the linked list formed after inserting this new node. The given head pointer may be null, meaning that the initial list is empty.
Input Format
You have to complete the SinglyLinkedListNode insertAtTail(SinglyLinkedListNode head, int data) method. …
This exercise is a part of my Linked List topic.
If you’re new to linked lists, this is a great exercise for learning about them. Given a pointer to the head node of a linked list, print its elements in order, one element per line. If the head pointer is null (indicating the list is empty), don’t print anything.
Input Format
The first line of input contains n, the number of elements in the linked list.
The next n lines contain one element each, which are the elements of the linked list.
This is a classic Linked List Node realization…
I started to learn a python programming language and the best way to learn some new language is a practice of course. I try to learn algorithms and data structures step by step on HackerRank. The goal of this post is a strong understanding of Linked List data structure and explanations of common Linked list exercises because the theory is nothing without practice.
LinkedIn Twitter Original Blog Github HackerRank
Taxi or travel apps always need to show the direction of travel on the map. In this quick tutorial, I will show you how to set up, show, and test the directional marker on the maps.
Completed tutorial on Github here.
So, at first, we need these keys in info.plist file. These settings will allow us to use user location detection from our app.
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your location is required for taxi correct work</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Your location is required for taxi correct work</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is required for taxi correct work</string>
Second, we need to import the CoreLocation
framework in…
I am a developer with 5 years of experience and I know how technologies work, replace each other, grow, and die (hi Google graveyard). I have a huge experience in the switch between different stacks. I worked as a WordPress/Woocommerce developer (little bit Laravel), HTML/CSS developer (6 months), Angular/Typescript developer (1.5 years), and iOS developer (more than 2 years). I always tried to find something which will be interesting for me. …