A Realm-like dynamic property wrapper that maps to APFS extended file attributes.

Last update: Jun 21, 2021

TOFileAttributes

TOFileAttributes is an abstract class that can be extended to enable reading and writing custom data to a local file's extended attributes. This allows quick and easy storage of transient information about a file (for example, the cursor position in a text file) in a non-destructive way that's invisible to the user.

The class is built upon the TOPropertyAccessor library which provides a Realm-like interface for defining custom model objects whose properties are mapped to an on-disk data store. This model makes it extremely easy and fast to set up new data schema, with all of the persistence logic handled under the hood.

Features

  • Properties defined in subclasses are directly mapped to attributes in a given file.
  • Instances are cached by default for easier re-use.
  • Properties are also cached internally in order to minimize the number of file reads and writes.
  • Certain properties can be marked as "ignored" and will function as normal.

Example

@interface FileAttributes : TOFileAttributes

@property (nonatomic, assign) NSInteger cursorPosition;

@end

// Fetch an instance of the class wrapped around a specific file.
FileAttributes *attributes = [FileAttributes attributesWithFileURL:URL];

// Save the current cursor position to disk
attributes.cursorPosition = 42;

Requirements

  • iOS 11.0 or higher
  • Xcode 12.0 or higher

Installation Instructions

Manual Installation
  1. Download the repositories for TOFileAttributes and TOPropertyAccessor.
  2. Install the source files from the TOFileAttributes and TOPropertyAccessor folders.
CocoaPods

Add pod 'TOFileAttributes' to your Podfile.

Credits

TOFileAttributes was written by Tim Oliver as a component of iComics 2.

License

TOFileAttributes is licensed under the MIT license. Please check the LICENSE file for more information.

GitHub

https://github.com/TimOliver/TOFileAttributes
You might also like...

Extended gamepad support for PICO-8

Extended gamepad support for PICO-8

Pinput Ever wish PICO-8 had dual analog stick support? Me too. Pinput is a Lua library that works with an external helper app to provide XInput-like g

Feb 17, 2022

macOS command line tool to return the available disk space on APFS volumes

diskspace Returns available disk space With the various APFS features the value for free disk space returned from tools such as du or df will not be a

Jun 10, 2022

Swift library for parsing Extended Backus–Naur Form (EBNF) notation

Gramophone Swift library for parsing Extended Backus–Naur Form (EBNF) notation Integration Swift Package Manager dependencies: [ .package(url: "ht

Dec 10, 2021

A collection of Swift Property Wrappers (formerly "Property Delegates")

🌯 🌯 Burritos A collection of well tested Swift Property Wrappers. @AtomicWrite @Clamping @Copying @DefaultValue @DynamicUIColor @EnvironmentVariable

Jun 24, 2022

A set of SwiftUI dynamic property wrappers that provide a more familiar API for accessing the Contacts framework. (iOS, watchOS, macOS)

Connections Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+ A set of SwiftUI dynamic property wrappers that provide a mo

Apr 18, 2022

In-app design review tool to inspect measurements, attributes, and animations.

In-app design review tool to inspect measurements, attributes, and animations.

Hyperion Hyperion - In App Design Review Tool What is it? Hyperion is a hidden plugin drawer that can easily be integrated into any app. The drawer si

May 23, 2022

Tool to debug layouts directly on iOS devices: inspect layers in 3D and debug each visible view attributes

Tool to debug layouts directly on iOS devices: inspect layers in 3D and debug each visible view attributes

Introduction Features Inspect layouts directly on iOS devices Inspection could be triggered only if app is running under DEBUG build configuration, so

Jun 14, 2022

A drop-in replacement for UILabel that supports attributes, data detectors, links, and more

TTTAttributedLabel A drop-in replacement for UILabel that supports attributes, data detectors, links, and more TTTAttributedLabel is a drop-in replace

Jun 20, 2022

LDOMarkdownParser - Parse (some) markdown attributes into an NSAttributedString

LDOMarkdownParser Description Convert markdown text styling into an NSAttributed

Feb 4, 2022

Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk.

PersistentStorageSerializable PersistentStorageSerializable is a protocol for automatic serialization and deserialization of Swift class, struct or NS

Jun 3, 2021

CoreData/Realm sweet wrapper written in Swift

CoreData/Realm sweet wrapper written in Swift

What is SugarRecord? SugarRecord is a persistence wrapper designed to make working with persistence solutions like CoreData in a much easier way. Than

Jun 16, 2022

A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

SwiftUI Drawer A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize. Contents Add the Package Basic Usage Examples Credits

Jun 16, 2022

Pull up controller with multiple sticky points like in iOS Maps

Pull up controller with multiple sticky points like in iOS Maps

PullUpController Create your own pull up controller with multiple sticky points like in iOS Maps Features Multiple sticky points Landscape support Scr

Jun 26, 2022

iOS - Subclass of UITextField to achieve autocompletion for Place Search like Google Places, Uber and Much more apps having maps.

MVAutocompletePlaceSearchTextField iOS - Subclass of UITextField to achieve autocompletion for Place Search like Google Places, Uber and Much more app

May 27, 2022

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

Jun 15, 2022

Backports the new @Invalidating property wrapper to older platforms

Backports the new @Invalidating property wrapper to older platforms

ViewInvalidating A property wrapper that backports the new @Invalidating property wrapper to older versions of iOS/tvOS/macOS. For more information on

Jun 4, 2022

Demonstration code for a simple Swift property-wrapper, keypath-based dependency injection system. The keypaths ensure compile-time safety for all injectable services.

Injectable Demo Preliminary musings and demonstration code for a simple Swift property-wrapper, keypath-based dependency injection system. The keypath

Jun 3, 2022

A Swift property wrapper which stores the previous value

swift-with-previous A Swift property wrapper which stores the previous value. The previous value can be get by the projected value $propertyName. impo

Feb 22, 2022
Realm is a mobile database: a replacement for Core Data & SQLite

Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the iOS, macOS, tvOS & wa

Jun 25, 2022
Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm.
Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm.

Unrealm enables you to easily store Swift native Classes, Structs and Enums into Realm . Stop inheriting from Object! Go for Protocol-Oriented program

Jun 22, 2022
Sample app to demonstrate data sharing between a WatchKit app and its main app using Realm
Sample app to demonstrate data sharing between a WatchKit app and its main app using Realm

#Done! A sample app demonstrating how to share data between an app an its Watch extension using Realm. You can read more about it here. ##Screenshot #

Apr 2, 2022
iOS price list app using Firebase, Realm & more
iOS price list app using Firebase, Realm & more

how-much iOS app to record how much things cost using various data persistence implementations. The basic data unit is an item, a simple dictionary: {

Feb 7, 2022
A small todo list with realm integration

RealmToDo Project Setup Install CocoaPods Open project directory in terminal and run pod install command Open Workspace of project *.xcworkspace Examp

May 16, 2022
A SwiftUI dynamic property wrapper for fetching media from your photo library. (iOS, tvOS, macOS)

Media Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+ A package for simplifying the user of the camera and the user's ph

Apr 15, 2022
Card-based view controller for apps that display content cards with accompanying maps, similar to Apple Maps.

TripGo Card View Controller This is a repo for providing the card-based design for TripGo as well as the TripKitUI SDK by SkedGo. Specs 1. Basic funct

May 26, 2022
🗺️ MAPS.ME — Offline OpenStreetMap maps for iOS and Android
🗺️ MAPS.ME — Offline OpenStreetMap maps for iOS and Android

MAPS.ME MAPS.ME is an open source cross-platform offline maps application, built on top of crowd-sourced OpenStreetMap data. It was publicly released

Jun 20, 2022
Realm RxSwift - This application was written in order to use Realm, RxSwift frameworks in real example

Realm_RxSwift This simple app was written to introduce basic operations of some

Apr 7, 2022
🕳 A simple command line tool to punch hole to reduce disk usage on APFS volume for such as a raw disk image.

HolePunch NAME holepunch -- A simple command line tool to punch hole to reduce disk usage on APFS volume for such as a raw disk image. SYNOPSIS holepu

Jun 10, 2022