//
//  NSFileManager+iCloudContainer.h
//  DOCore
//
//  Created by Mark Schultz on 8/15/14.
//
//

#import <Foundation/Foundation.h>

@interface NSFileManager (iCloudContainer)

/** 
 * Returns the URL for the iCloud container used by the app
 * and establishes access to that container.
 *
 * @return A URL pointing to the specified ubiquity container, or @c nil if the container could not be located
 * or if iCloud storage is unavailable for the current user or device.
 *
 * @warning Do not call this on the main thread.
 * @see [NSFileManager URLForUbiquityContainerIdentifier:]
 */
- (NSURL *)URLForiCloudContainer;

/**
 * Obtains the URL for the iCloud container used by the app
 * and establishes access to that container, and then returns that URL in the completion block.
 *
 * @note    This is safe to call from the main thread. This method switches to a background thread to obtain the URL and
 *          then switches back to the main thread to call the completion block.
 *
 * @param   completion A block that will be called after the URL is obtained and access to the container is established.
 */
- (void)requestURLForiCloudContainer:(void(^)(NSURL *containerURL))completion;

@end
