A macOS Cocoa framework made up of useful bits of code from my side projects.
Written by Zach Nelson. See the LICENSE file for license info (it's the MIT license).
CoreZen
links against and bundles FMDB.framework. The Xcode project is set up to find FMDB installed using Carthage.
Installation: Run carthage update --platform mac
to build Carthage/Build/Mac/FMDB.framework. The CoreZen
Xcode project will find it from there.
CoreZen
links against and bundles dynamic libraries for libmpv and libav. The Xcode project is set up to find headers and libraries installed using Homebrew.
Installation:
- Run
brew install mpv ffmpeg
to install mpv and libav. - Run
Scripts/stage_dependencies.py
. This will gather mpv and libav dylibs and headers into Dependencies/lib and Dependencies/include, respectively. TheCoreZen
Xcode project will find them there.
Create dynamic preference windows, inspired by CCNPreferencesWindowController
.
Categories to add functionality to Foundation classes:
NSFileManager+CoreZen
: get application support directory path and executable nameNSNumber+CoreZen
: generate a random integerNSURL+CoreZen
: find volume details from a URL or volume UUID, get relative paths between URLs, find a URL file size
ZENIdentifier
is an (atomically unique increasing) 64-bit integer identifier and the ZENIdentifiable
protocol is for objects with such an identifier.
ZENObjectCache
is a thread safe object cache for ZENIdentifiable
objects, configurable to hold either weak or strong refs to cached objects.
Helper classes around FMDB and sqlite3, including:
ZENDatabaseQueue
is a database queue with both blocking and async execution options, and shutdown mechanics to handle outstanding async work. (FMDatabaseQueue
offers only blocking methods.ZENDatabaseQueue
still works with FMDBFMDatabase
instances and standard sqlite3 databases.)ZENDataTransferObject
is aZENIdentifiable
object to build DTOs.ZENDataTransferObject
serves as a base class for simple data storage objects which may be serialized (including to and from an sqlite3 database).- The
ZENDatabaseTable
protocol to abstract the FMDB work for create, read, update, and delete operations onZENDataTransferObject
s on an sqlite3 database table. ZENDatabaseSchema
performs simple dynamic database schema updates based an array ofZENDatabaseTable
objects.
Note on dependencies: ZENDatabaseQueue
and other classes in CoreZen
depend on FMDB.framework. See above for installation from Carthage.
Helper classes to build a domain model, including:
ZENDomainObject
is aZENIdentifiable
object built around aZENDataTransferObject
, allowing asynchronous initialization after initial creation or retrieval from database (or other serialization). Subclasses overridingperformAsyncInit:completion:
can do work such as checking a file's existence on disk, reading media file metadata, or even fetching other objects from the database (which themselves can then perform asynchronous initialization work).ZENDomainObject
allows async init to be performed on an array of objects at once, and will automatically distribute the work using dispatch queues.ZENObjectRepository
is an object repository combining aZENDatabaseQueue
and aZENDatabaseTable
for object persistence, with a strong or weakZENObjectCache
.ZENObjectRepository
exposesZENDomainObjects
while hiding the details of storing and retrieving objectZENDataTransferObjects
throughZENDatabaseTable
.ZENObjectRepository
also hides the complexity of asynchronously initializing the domain objects after retrieval, and caches domain objects in itsZENObjectCache
to avoid repeated async initialization costs.
Classes to support reading audio and video media files:
ZENMediaFile
is a Work In Progress. Currently supports only basic media metadata retrieval including: video frame size, media duration, and audio and video codec names.
Note on dependencies: ZENMediaFile
and other classes in CoreZen
depend on libmpv and libav. See above for installation from Homebrew.