The async/await syntax was introduced in Swift 5.5 with Meet async/await in Swift
in WWDC 2021. It is a more readable way to write asynchronous code and is easier to
understand than dispatch queues and callback functions. The async/await syntax is
similar to those used in other programming languages like C# or …
The Swift standard library provides an ArraySlice to work with a subset of a larger
collection without the overhead of making a copy of the original collection.
Retrieving the first few elements of a collection can be achieved using the one-sided
range operator, but is safer to use the prefix method without having to …
Apple introduced SwiftUI Charts at WWWDC 2022, which makes it incredibly easy to
create charts within SwiftUI views. The default chart presents the entire data in the
chart plot regardless of how much data is available. It can be beneficial to show
more details on a chart and add the ability to scroll through the …
Apple introduced NavigationStack and NavigationSplitView at WWWDC 2022 to replace
NavigationView, which has been deprecated. The documentation for NavigationSplitView
includes sample code, but the code does not work as it is missing model data. Here is
some model data to allow the sample code in the documentation to …
There are multiple ways to define colors in code. The most commonly used method is to
specify values for the three primary colors - red, green and blue (RGB). This article
explores the use of an alternative mechanism by specifying values for hue, saturation
and brightness (HSB). The HSB properties can be used in a more …
There are times when data in a bar chart has similar values for a number of the bars
and it can be difficult to see the differences. One option is to zoom in on the top
section of the bar chart. This article investigates a number of options and
identifies the best approach for this in Swift Charts.
I came across the Matthew effect recently, which struck me as very unfair so I
wondered if I could reproduce the results demonstrated. This article outlines the
Swift code for an app to test the redistribution of coins in a closed population
based on random coin tosses between agents in the population.
A Slider control is a UI control that allows the user to select a value from within a
range of values. In SwiftUI, it is usually presented as a thumb selector on a linear
line. There are times when it might be better to present this type of selector as a
circle with the thumb moving around the circumference. This …
At WWWDC 2022, Apple introduced SwiftUI Charts, which makes it easy to create
various charts within SwiftUI views. This article demonstrates how to quickly create
a bar chart and customise the chart containing multiple sets of data.
SwiftUI Charts introduced in iOS 16, can present data in an intuitive visual format
and can be created quickly using SwiftUI Charts. This article demonstrates a couple
of ways to customise a line chart and combine with an area chart to present data.