Problem I have an array of date objects, which I want to group by year and month. The data structure […]
Category: Swift
Listening to IOKit events with Swift 3
Problem This is my first program in Swift/Xcode. The full source code and xcode project is available in GitHub. The […]
A consumable byte array, in Swift
Problem For decoding binary data (in my case, delivered by a Bluetooth device), I’ve written this struct: public struct ConsumableByteArray […]
Generic Fenwick Tree
Problem A Fenwick Tree, or a Binary Indexed tree, is an interesting data structure that can efficiently update its elements. […]
UIAlertController and input validation
Problem I’m refactoring some “old” Swift code using deprecated UIAlertView and delegates. I have a UIAlertController with an input textfield […]
Project Euler #3 (Largest prime factor) in Swift
Problem As mentioned in Project Euler #2 in Swift, I intend to work my way through Project Euler using Swift […]
Extract index of first unique element in large array in Swift
Problem I’m using the following code to return the first index of a unique character in a large String. It […]
Blocking call to an async function
Problem While migrating to structured concurrency it may be sometimes convenient to temporarily make a blocking call to an async […]
Swift Hackerrank Dynamic Array
Problem I’ve solved this question. Wasn’t sure if I was suppose to use a dictionary in this case, as the […]
Swift code to extract most common page sequences from an Apache server log
Problem So I received the following prompt for a code interview: “Please create an iOS app that downloads a text […]