This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#1
33 lines
1.4 KiB
Objective-C
33 lines
1.4 KiB
Objective-C
#import "NSBundle+TestAssets.h"
|
|
|
|
@implementation NSBundle (TestAssets)
|
|
|
|
- (NSString *)wmf_stringFromContentsOfFile:(NSString *)filename ofType:(NSString *)type {
|
|
NSError *error;
|
|
NSString *string = [NSString stringWithContentsOfFile:[self pathForResource:filename ofType:type inDirectory:@"Fixtures"]
|
|
encoding:NSUTF8StringEncoding
|
|
error:&error];
|
|
NSAssert(!error, @"Unexpected error reading test fixture: %@.%@, %@", filename, type, error);
|
|
return string;
|
|
}
|
|
|
|
- (NSData *)wmf_dataFromContentsOfFile:(NSString *)filename ofType:(NSString *)type {
|
|
NSError *error;
|
|
NSData *data = [NSData dataWithContentsOfFile:[self pathForResource:filename ofType:type inDirectory:@"Fixtures"]
|
|
options:0
|
|
error:&error];
|
|
NSAssert(!error, @"Unexpected error reading test fixture: %@.%@, %@", filename, type, error);
|
|
return data;
|
|
}
|
|
|
|
- (id)wmf_jsonFromContentsOfFile:(NSString *)filename {
|
|
NSError *error;
|
|
id json = [NSJSONSerialization JSONObjectWithData:[self wmf_dataFromContentsOfFile:filename ofType:@"json"]
|
|
options:NSJSONReadingMutableContainers
|
|
error:&error];
|
|
NSAssert(!error, @"Error reading JSON data from filename %@: %@", filename, error);
|
|
return json;
|
|
}
|
|
|
|
@end
|