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
Codableextensions, logging, cancellation, wildcard matching,CommonError, and error helpers. - DictionaryParsing and Filesystem & Bundle: nested dictionary reading and writing,
FileStore,FileEnumerator, andTemporaryDirectory. - 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.
HTTPRequestbuilds requests;HTTPMethod,HTTPHeader, andHTTPQueryItemdescribe their parts.HTTPClientoffers callback and async APIs for data or decoded objects;HTTPResultkeeps the value and HTTP response together.
SpellbookBinaryParsing
Read and write binary data at explicit offsets or sequentially.
BinaryReaderreads bytes and fixed-size values fromDataor a customBinaryReaderInput.BinaryWriterwrites to aBinaryWriterOutput, including the providedDataBinaryWriterOutput;BinaryParsingErrorreports parsing failures.
SpellbookGraphics
Color and Core Graphics conveniences, separate from UI views.
RGBColorrepresents RGBA values, accepts hex colors, and bridges toCGColorand available platform color types.- Core Graphics extensions add geometry operations and
CGImagefile conversion helpers.
SpellbookCrash
Attach application context to Apple crash reports.
CrashReportAugmentationadds and removes messages, including scoped messages for synchronous or async work.CrashInfoprovides access to the crash report's__crash_infostorage.
SpellbookUI
A small SwiftUI extension for conditionally transforming a view.
View.modifyapplies a transform when it produces a view and otherwise returns the original view.
SpellbookTestUtils
Helpers for XCTest suites.
XCTestCaseandTimeIntervalextensions provide test bundles, temporary directories, and scaled expectation timeouts.TestDatasupplies sample URLs, whileTestErrorprovides a simple error for tests.
Package Metadata
Repository: alkenso/swiftspellbook
Default branch: main
README: README.md