Topic Archives: Codebase

iOS Persistence with UserDefaults

Persistence can be defined as saving data to a place where it can be re-accessed and retrieved upon restart of the device or app. This can mean non-volatile memory on a device or saving data to remote servers. Persistence is necessary for any app that wants to store data in the long term, that is longer than a lifecycle of a running app, and keep it available to the user.… Read the rest

Benefits and Risks of Singletons

Three singletons types frequently occur throughout iOS SDK and codebases. Let us name them and examine their benefits and risks. They are as follows:

class ExampleOne {
    static let shared = ExampleOne()

    private init {}
class ExampleTwo {
    static let shared = ExampleTwo()
class ExampleThree {
    static var sharedInstance = ExampleThree()

ExampleOne is by the book Singleton implementation.… Read the rest

Maintaining Logs

It is highly likely that a development team will log informational messages, errors, and warnings. The team determines the format and log content. Mistakes can happen. The signs of trouble ahead are: application life cycle events and user touches unleash print-out hell.… Read the rest