Contents

alkenso/swiftspellbook

SwiftSpellbook is a collection of small Swift libraries for Apple platform development. It grew out of utilities reused across macOS and iOS projects. Pick the products you need; the package has no external dependencies.

Motivation

While participating in many projects (macOS and iOS) I use the same tools and standard types extensions. Once I've decided stop to copy-paste code from project to project and make single library that covers lots of developer needs in utility code.

Libraries

SpellbookFoundation

General purpose utilities used throughout the package. The main areas are:

  • Common and Errors: collection and Codable extensions, logging, cancellation, wildcard matching, CommonError, and error helpers.
  • DictionaryParsing and Filesystem & Bundle: nested dictionary reading and writing, FileStore, FileEnumerator, and TemporaryDirectory.
  • Threading & Concurrency: locks, Synchronized, Atomic, queues, promises, and synchronous/asynchronous bridges.
  • ValueObserving: stores, broadcasts, observers, and views for sharing and tracking values.
  • Types & PropertyWrappers: Either, Pair, boxing, refreshable values, and resource lifetime helpers.
  • Combine, Low Level, and System & Hardware: publisher helpers, memory and C interop, process information, and device information. Some APIs, such as IOKitError, are macOS only.

SpellbookHTTP

Build and send HTTP requests with URLSession.

  • HTTPRequest builds requests; HTTPMethod, HTTPHeader, and HTTPQueryItem describe their parts.
  • HTTPClient offers callback and async APIs for data or decoded objects; HTTPResult keeps the value and HTTP response together.

SpellbookBinaryParsing

Read and write binary data at explicit offsets or sequentially.

  • BinaryReader reads bytes and fixed-size values from Data or a custom BinaryReaderInput.
  • BinaryWriter writes to a BinaryWriterOutput, including the provided DataBinaryWriterOutput; BinaryParsingError reports parsing failures.

SpellbookGraphics

Color and Core Graphics conveniences, separate from UI views.

  • RGBColor represents RGBA values, accepts hex colors, and bridges to CGColor and available platform color types.
  • Core Graphics extensions add geometry operations and CGImage file conversion helpers.

SpellbookCrash

Attach application context to Apple crash reports.

  • CrashReportAugmentation adds and removes messages, including scoped messages for synchronous or async work.
  • CrashInfo provides access to the crash report's __crash_info storage.

SpellbookUI

A small SwiftUI extension for conditionally transforming a view.

  • View.modify applies a transform when it produces a view and otherwise returns the original view.

SpellbookTestUtils

Helpers for XCTest suites.

  • XCTestCase and TimeInterval extensions provide test bundles, temporary directories, and scaled expectation timeouts.
  • TestData supplies sample URLs, while TestError provides a simple error for tests.

Package Metadata

Repository: alkenso/swiftspellbook

Default branch: main

README: README.md