Skip to content
Framework for reading/writing TextBundle files
Branch: master
Clone or download
Latest commit 1bef83d May 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
TextBundle-Mac Initial commit Feb 22, 2019
TextBundle-iOS Added iOS framework Feb 25, 2019
TextBundle.xcodeproj Handling invalid file formats May 21, 2019
TextBundle Handling invalid file formats May 21, 2019
TextBundleTests
.gitignore Initial commit Feb 22, 2019
LICENSE Initial commit Feb 22, 2019
README.md Readme update May 10, 2019

README.md

TextBundle

TextBundleWrapper is a fast and simple Library for reading/writing TextBundle files.

Table of Contents

Installation

TextBundleWrapper is a single class with no dependencies, you can install it from source code, using Carthage or embedding the TextBundle.framework in your project.

Install from sources

Just download and drag the TextBundleWrapper.{h,m} files in your Xcode project

Carthage

To install with Carthage, add the following to your Cartfile: github "CocoaLumberjack/CocoaLumberjack"

Framework

Reference the TextBundle.xcodeproj in your project and drag the TextBundle.framework inside the Embedded Binaries in the General tab of the target setting.

Usage

If you're using TextBundle as a framework, you can @import CocoaLumberjack if you’re using swift or #import <CocoaLumberjack/CocoaLumberjack.h> for Obj-C.

Reading the TextBundle Text

NSError *e = nil;
TextBundleWrapper *tb = [[TextBundleWrapper new] initWithContentsOfURL:fileURL 
                                                               options:NSFileWrapperReadingImmediate 
                                                                 error:&e];

// Reading the plain text content
NSString *text = tb.text;

// The UTI of the text (Markdown, HTML, etc...)
NSString *type = tb.type;

Reading the TextBundle Assets

// Iterating the asset files
[tb.assetsFileWrapper.fileWrappers enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSFileWrapper *fw, BOOL *stop) 
{
    // File name
    NSString *filename = fw.filename;

    // Writing the file somewhere
    [fw writeToURL:URL options:0 originalContentsURL:nil error:nil];
}];

Reading the TextBundle Meta Data

TextBundleWrapper conforms to the TextBundle Specification, please use the specs as reference for properties and their values.

NSDictionary *metadata = tb.metadata;

Author

Matteo Rattotti

License

TextBundleWrapper is available under the MIT license. See the LICENSE file for details.

Contacts

If you want to ask a technical question, feel free to raise an issue or write to hello@shinyfrog.net.

You can’t perform that action at this time.