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.
Apple introduced SwiftUI Charts at WWWDC 2022, which makes it incredibly easy to
create charts within SwiftUI views. Charts are a great way of presenting visual data
in a rich format that is easy to understand. This article shows how to easily create
a line chart with so much less code than was previously used to …
Data stored in a csv file can often contain JSON objects in one of the fields. The
csv data can easily be loaded into a Pandas Dataframe for analysis. Fields of
interest in the JSON object can also be extracted into their own column easily using
Reduce is a simple way to perform an operation over each element in a collection and
condense down to a single value. It is commonly used on a list of numeric values to
add up all the values.
SwiftUI does not have a control to present an open/save dialog to the user to allow
saving files to the macOS filesystem. One could build such a view from scratch, but
it is easier to use NSSavePanel from AppKit. This article demonstrates how to use
NSSavePanel to get the URL for the file to be saved and use …
Swift provides a number of map methods to transform elements in Swift collections and
return the transformed data in a new Array. The transform is supplied in a trailing
closure to the map function. This article looks at Map, FlatMap and CompactMap on
collections in Swift as well as MapValues in Dictionary.
A dictionary stores a list of key/value pairs in an unordered structure that is fast
and efficient at adding elements and finding elements by a key. Each element in the
dictionary is identified using its key, which is a hashable type such as a string or