Added NSBundle helpers to Support.h. Introduced convenience method for retrieving reference to RestKitResources.bundle

This commit is contained in:
Blake Watters
2012-02-24 15:44:18 -05:00
parent 3526dac424
commit 5ae94287e9
29 changed files with 26 additions and 86 deletions

View File

@@ -30,6 +30,17 @@
*/
@interface NSBundle (RKAdditions)
/**
Returns an NSBundle reference to the RestKitResources.bundle file containing
RestKit specific resource assets.
This method is a convenience wrapper for invoking
`[NSBundle bundleWithIdentifier:@"org.restkit.RestKitResources"]`
@return An NSBundle object corresponding to the RestKitResources.bundle file.
*/
+ (NSBundle *)restKitResourcesBundle;
/**
Returns the MIME Type for the resource identified by the specified name and file extension.

View File

@@ -26,6 +26,10 @@
@implementation NSBundle (RKAdditions)
+ (NSBundle *)restKitResourcesBundle {
return [NSBundle bundleWithIdentifier:@"org.restkit.RestKitResources"];
}
- (NSString *)MIMETypeForResource:(NSString *)name withExtension:(NSString *)extension {
NSString *resourcePath = [self pathForResource:name ofType:extension];
if (resourcePath) {

View File

@@ -3,7 +3,7 @@
// RestKit
//
// Created by Blake Watters on 9/30/10.
// Copyright 2010 Two Toasters
// Copyright 2010 RestKit
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -22,10 +22,11 @@
#import "RKErrors.h"
#import "RKMIMETypes.h"
#import "RKLog.h"
#import "RKPathMatcher.h"
#import "RKDotNetDateFormatter.h"
#import "RKDirectory.h"
// Load our categories
#import "NSDictionary+RKAdditions.h"
#import "NSString+RestKit.h"
#import "RKPathMatcher.h"
#import "RKDotNetDateFormatter.h"
#import "RKDirectory.h"
#import "NSBundle+RKAdditions.h"