Inherits from NSObject
Conforms to MMWormholeTransiting
Declared in MMWormholeFileTransiting.h

Overview

This class is a default implementation of the MMWormholeTransiting protocol that implements message transiting by archiving and unarchiving messages that are written and read to files on disk in an optional directory in the given app group. This default implementation has a relatively naive implementation of file writing, and simply uses the built in NSData file operations.

This class is able to be subclassed to provide slightly different file reading and writing behavior while still maintaining the logic for naming a file within the given directory and app group.

Tasks

  • – initWithApplicationGroupIdentifier:optionalDirectory:

    Designated Initializer. This method must be called with an application group identifier that will be used to contain passed messages. It is also recommended that you include a directory name for messages to be read and written, but this parameter is optional.

  •   fileManager

    The File Manager associated with this transiting implementation. You can use this property for implementing your own variant of file transiting that needs to customize where and how files are stored.

    property
  • – messagePassingDirectoryPath

    This method returns the full file path for the message passing directory, including the optional directory passed in the designated initializer. Subclasses can use this method to provide custom implementations.

  • – filePathForIdentifier:

    This method returns the full file path for the file associated with the given message identifier. It includes the optional directory passed in the designated initializer if there is one. Subclasses can use this method to provide custom implementations.

Properties

fileManager

@property (nonatomic, strong, readonly) NSFileManager *fileManager
Discussion

The File Manager associated with this transiting implementation. You can use this property for implementing your own variant of file transiting that needs to customize where and how files are stored.

Declared In

MMWormholeFileTransiting.h

Instance Methods

filePathForIdentifier:

- (nullable NSString *)filePathForIdentifier:(nullable NSString *)identifier
Discussion

This method returns the full file path for the file associated with the given message identifier. It includes the optional directory passed in the designated initializer if there is one. Subclasses can use this method to provide custom implementations.

Return Value

The full path to the file associated with the given message identifier.

Declared In

MMWormholeFileTransiting.h

initWithApplicationGroupIdentifier:optionalDirectory:

- (instancetype)initWithApplicationGroupIdentifier:(nullable NSString *)identifier optionalDirectory:(nullable NSString *)directory
Discussion

Designated Initializer. This method must be called with an application group identifier that will be used to contain passed messages. It is also recommended that you include a directory name for messages to be read and written, but this parameter is optional.

Parameters

identifier

An application group identifier

directory

An optional directory to read/write messages

Declared In

MMWormholeFileTransiting.h

messagePassingDirectoryPath

- (nullable NSString *)messagePassingDirectoryPath
Discussion

This method returns the full file path for the message passing directory, including the optional directory passed in the designated initializer. Subclasses can use this method to provide custom implementations.

Return Value

The full path to the message passing directory.

Declared In

MMWormholeFileTransiting.h