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 ffmpegto 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. TheCoreZenXcode 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:
ZENDatabaseQueueis a database queue with both blocking and async execution options, and shutdown mechanics to handle outstanding async work. (FMDatabaseQueueoffers only blocking methods.ZENDatabaseQueuestill works with FMDBFMDatabaseinstances and standard sqlite3 databases.)ZENDataTransferObjectis aZENIdentifiableobject to build DTOs.ZENDataTransferObjectserves as a base class for simple data storage objects which may be serialized (including to and from an sqlite3 database).- The
ZENDatabaseTableprotocol to abstract the FMDB work for create, read, update, and delete operations onZENDataTransferObjects on an sqlite3 database table. ZENDatabaseSchemaperforms simple dynamic database schema updates based an array ofZENDatabaseTableobjects.
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:
ZENDomainObjectis aZENIdentifiableobject 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).ZENDomainObjectallows async init to be performed on an array of objects at once, and will automatically distribute the work using dispatch queues.ZENObjectRepositoryis an object repository combining aZENDatabaseQueueand aZENDatabaseTablefor object persistence, with a strong or weakZENObjectCache.ZENObjectRepositoryexposesZENDomainObjectswhile hiding the details of storing and retrieving objectZENDataTransferObjectsthroughZENDatabaseTable.ZENObjectRepositoryalso hides the complexity of asynchronously initializing the domain objects after retrieval, and caches domain objects in itsZENObjectCacheto avoid repeated async initialization costs.
Classes to support reading audio and video media files:
ZENMediaFileis 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.