Swift posts

Recursive Algorithms vs Dynamic Programming

Why do we convert Recursive algorithms to DP typically? Analyse and compare the convenience and efficiency of recursive vs DP solutions for an edge case problem w/ Swift.

DFS vs BFS for Bipartite Graph Problems with Swift

Analyse and compare the convenience and efficiency of DFS and BFS solutions for the Bipartite Graph detection problem (Swift).

Array Partitioning Schemes in Swift

Implement the Hoare + Lomuto Partitioning Schemes (QuickSort) with the Swift stdlib. Discuss wider application of the schemes to solve problems.

Writing a Heap from scratch in Swift

Use the Swift 4+ stdlib for writing a Min/Max Heap. Discuss challenge of implementing nonlinear data structures in Swift.

Prune nested Swift Package dependencies

Subtle tip for SPM projects: Only import the package libraries you need for each target to reduce final binary size and optimise build times.

Cleanly check if an Index is valid with Swift

Use generic extensions, modules and the Swift stdlib for efficient and reusable index checks. Also useful for library vendors looking to expose a minified API.

How to write a recursive Either enum with Swift

How to write a recursive Either enum with Swift written using generic associated values. Stretch the limits of a strict, statically typed and mostly imperative language!

Strategies for take-home coding tests

Coding ability improves through consistent and deliberate coding. The way to ace a coding test is to take care in details even when not being assessed.

Why you shouldn't be using print()

Explore the new Logger class for useful, privacy-friendly, scalable logging in Swift apps. Understand why Apple promotes unified logging over print for production apps.