Skip to content

NormanBitSolace/BlackLabs

Repository files navigation

BlackLabs

A Swift Package containing Foundation, UIKit, and original type helpers and extensions.


  • Bundle - convenience helpers and extensions to access local files and common plist entries like app name and version.
  • CGContext - convenience methods to draw lines and text in a CGContext.
  • CGGeometry - convenience helpers for CGSize and CGRect and arrays containing those types.
  • CloudKit - convenience helpers and extensions for Apple's CloudKit API.
  • Collection- convenience helpers and extensions for Collection.
  • Color - convert CSS color names and RGB hex values to UIColor. UIColor from hex 3, 4, 6, and 8 characters in length with or without # prefix. UIColor to hex. UIColor extension that creates immutable UIColor instances from hexadecimal and CSS color name strings (e.g. ff0, #f00, ff0000, ff0000ff, Pink, aZure, CLEAR, nil).
  • CommonColors - defines commonly used colors e.g. appWhite, appBlack, iOS7Blue, veryLightGray, evenColor, and oddColor.
  • Data - convenience helpers and extensions for Data handling, in particular when using REST.
  • Date - convenience helpers and extensions for working with Dates.
  • DeviceModels - a list of Apple device models (e.g. iPhone1,1). This list is generated from the a well maintained gist by Adam A Wolf.
  • Encodable - convenience methods to encode a Encodable object and view it as a JSON string.
  • File - Utilities for handling iOS document and app support as well as general encoding, decoding, data, etc. helpers.
  • Grid - a generic class to handle 2D Arrays.
  • Holiday - convenience helpers and extensions for determine non fixed Holidays (e.g. 3rd Monday of February) based on Date and Calendar.
  • NetworkError - enum of network errors. Results require an Error though in practice I don't bubble up these errors to the UI so this class is little used.
  • Notifications - prior to iOS 9 it was useful to use a token to ensure NotificationCenter.removeObserver was called, this class helps with that.
  • Number - convenience helpers and extensions for Int, CGFloat, and Double types e.g. formatting, conversion, and iterating.
  • Object - computed vars to access class name.
  • Queue - A generic queue struct (thanks Ray Wenderlich algorithms).
  • RestHelper - a protocol and extensions to generalize REST CRUD. This protocol allows an app to use dependency injection of it's data services so testing can use different implementations.
  • RestPath - utilities for creating REST URL paths.
  • RestService - A simple way to create a REST data service to handle failable CRUD operations (optionally in parallel).
  • Result - Extension to decode a Results Data when successful with let pet: Pet = result.decode().
  • Stack - A generic stack struct (thanks Ray Wenderlich algorithms).
  • String - String extensions e.g. contains(). Support for comma separated values.
  • UIDevice - defines Screensize struct, ScreenType enum. Extends UIDevice with modelName, isPad, isPhone, isSimulator, screenType, size, and landscapeSize properties.
  • UIView - convenience helpers and extensions for UIView.
  • UIViewController - convenience helpers and extensions for UIViewController .
  • UndoHistory - a very simple way to implement undo in an app.
  • URL - URLs are extended to GET, POST, PUT, and DELETE. Helpers for getting Codable, UIImage, and Data in serial or parallel.
  • URLRequest & URLResponse - Get method, url, status code, and header info.
  • URLSession - allows logging of information about network requests and responses.
  • UserDefaults - utilities for using UserDefaults e.g. setting and getting Codable objects.