Inherits from NSObject
Declared in NMBFolderController.h

Overview

NMBFolderController is an utility to help you implement a file browser. With it you can access the file system of NimbusBase, and be notified when changes happened. Basically, the files contained by NimbusBase are a subset of your files on the cloud. Once you access your cloud, the retrieved files can be browsed offline. The usage of NMBFolderController is much like NSFetchedResultsController’s.

Properties

delegate

The object that is notified when the files or file promises in this folder changed.

@property (nonatomic, weak) id<NMBFolderControllerDelegate> delegate

Declared In

NMBFolderController.h

folder

The folder you passed into method initWithFolder:server:.

@property (nonatomic, readonly, strong) NMBFile *folder

Discussion

It has to be a folder type file, or you will get an exception.

Declared In

NMBFolderController.h

sections

The sections for the file promises and files.

@property (nonatomic, readonly) NSArray *sections

Discussion

The objects in the sections array implement the NSFetchedResultsSectionInfo protocol. There are always two sections returned via this property. The first one contains instances of NMBPromise, which present creating and updating operations of files. Deleting and retrieving are not contained. The second section contains instances of NMBFile, which present the files not being modified. The order of files is ‘modified-recently-first’.

Declared In

NMBFolderController.h

server

The server you passed in method initWithFolder:server:.

@property (nonatomic, readonly, strong) NMBServer *server

Declared In

NMBFolderController.h

Instance Methods

initWithFolder:server:

Returns a folder controller initialized using the given arguments.

- (instancetype)initWithFolder:(NMBFile *)folder server:(NMBServer *)server

Parameters

folder

The folder contains the files you want to retrieve.

server

The cloud server stores the folder, which serves CRUD operations for the files.

Return Value

The receiver initialized with the specified folder and server.

Declared In

NMBFolderController.h

objectAtIndexPath:

Returns the object at the given index path in the file promises and files.

- (id)objectAtIndexPath:(NSIndexPath *)indexPath

Parameters

indexPath

An index path in file promises and files. If indexPath does not describe a valid index path in the fetch results, an exception is raised.

Return Value

The object at a given index path in the file promises and files.

Declared In

NMBFolderController.h

performFetch:

Executes the receiver’s fetch request.

- (BOOL)performFetch:(NSError **)error

Parameters

error

If the fetch is not successful, upon return contains an error object that describes the problem.

Return Value

YES if the fetch executed successfully, otherwise NO.

Discussion

After executing this method, you can access the file promises and files contained in the receiver with the property sections.

Declared In

NMBFolderController.h