Apple introduced SwiftUI in 2019 as a lightweight and easy-to-use way to create user interfaces. This article series explores how the SwiftUI framework can help us build clean, simple, and stunning data visualization tools, starting with the radar chart.
A radar chart (also known as a web chart, spider chart, or Kiviat diagram) is a way to represent multiple variables in the same plot, on axes that start at the same point but extend in different directions. …
Sometimes you are assigned to program something that you know. It may be a piece of UI that you have created before, or it may be an algorithm that you know by heart and can work out in a matter of minutes.
Other times, you are faced with harder problems and need to write code to perform tasks you may not even understand. These are situations where you need to think before you act, or end up in a tangled mess. …
SwiftUI has spellbound an entire developer community since the introduction at WWDC 2019, and it is quite easy to understand why. It is fast, concise, and lets you build an entire working application with very few lines of code.
However, SwiftUI is still in its infancy and lacks many of the standard components we take for granted with more mature frameworks. Luckily, Apple’s engineers have developed ways to connect elements from UIKit straight into our SwiftUI applications. In this article, we look at how to leverage those mechanisms to create a SwiftUI wrapper for the good old UICollectionView.
A playground with code examples is available on Github. …
Since the birth of Swift’s property wrappers, I have seen numerous articles discussing how to create a wrapped variable that can persist itself to the UserDefaults sector. While many of the code examples suffice for the simplest case, I’ve still had some questions gnawing at the back of my head.
In this article, we look at how to make a property wrapper that persists your variables in UserDefaults. They also stay on top of any value changes, regardless of where they originate. …
Protocol Oriented Programming is probably one of the more advanced topics in Swift programming. To some, it means that a defining protocol should accompany the public interface of any class or struct in a project. To others, it is a concept that is only used by developers who like to show off their mad skills. In this article, we take a look at how we can leverage protocols to do useful work in our programs.
We will extend a few standard library components to add methods and properties for statistical analysis. Most of us probably already have some experience with extensions — it’s easier to show something useful by building on something that we all use regularly. …
Some problems are impossible to know the exact answer to. They involve random variables that aren’t guaranteed to have the same value every time, which ruins our chances of drawing conclusions with certainty. When we find ourselves in such situations, we turn to probabilistic theories for help. This article takes a look at the Monte Carlo Method, which allows us to get a sense of how likely a specific outcome is.
The code used to perform the simulations is available on Github.
Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. …
Working on remote is becoming increasingly popular among developers. Some of us choose to work remotely every day; some of us are happy with a few days per week. However, some still need to go into the office every single day. The issue could be that the company is not familiar with the concept of working remotely. It could also be that they fear losing control of their employees daily contributions. There is extensive research conducted on the subject of remote work. …
I believe that we, as working developers, need to be very careful about what frameworks we add to our projects. The list of questions we should ask ourselves before adding a framework to our projects is at least a mile long (depending on your font size of choice). However, there are some frameworks that are so fundamental that doing anything without them would be very difficult and cumbersome. In this article, we take a look at four frameworks that all iOS Developers will need to get a grasp on very early on in their careers.
The Foundation Framework provides some base functionalities that iOS developers almost seem to take for granted these days. …
Physical activity has been shown to improve a person's wellbeing and health. For a long time, this has been closely associated with just the part of a person’s health that has to do with their waistline and body fat content. However, recent studies are providing compelling evidence that keeping physically active can improve your cognitive functions and even help grow certain parts of the brain.
According to an article in Harvard Health Blog, physical exercise helps the brain in both direct and indirect ways. Reduced inflammation and release of growth factors are two direct ways in which exercise contributes to your brains health. By improving sleep and reducing stress, it also contributes in more indirect ways. Many studies have also suggested a relation between physical exercise and the size of the areas in the brain that control thinking and memory. “Even more exciting is the finding that engaging in a program of regular exercise of moderate intensity over six months or a year is associated with an increase in the volume of selected brain regions”, says Dr. …
Sometimes, we end up writing a class with a huge amount of methods that all look annoyingly similar, but there are key differences in the way they calculate things that keep us from writing one generalized function and throwing out the rest. Today, we’re going to take a look at a design pattern that allows us to create that one function to rule them all so that we can scrap those annoying almost-duplicate methods. Enter The Strategy Pattern.
The Strategy Pattern is an object-oriented programming construct. It is a behavioral pattern that is also known as the Policy Pattern. The idea behind it is that the program should be able to defer the selection of an algorithm until runtime, and not be stuck with a set procedure after the compiler has done its job. …
About