ObjC is not all that different from Python in this respect. In both languages, data can be associated with an object, local to a function/method, or global. You can pass data directly from one method to another as arguments, or indirectly by storing it somewhere that both methods have access to (for example, an instance variable).
For the former, you would do something like this (hypothetical implementation filled in, since I don't know what your methods do):
@implementation MyClass //in the .m
- (void) openFile:(NSString *)pathToFile {
NSData *fileData = [NSData dataWithContentsOfFile:pathToFile];
[self convertFile:fileData];
}
- (void) convertFile:(NSData *)fileData {
//whatever you wanted to do to fileData
}
@end
For the latter, you'd need to declare storage on the object for the thing you want to store, as well as how that storage should be accessed. Modern ObjC combines these tasks with the @property
syntax:
@interface MyClass : NSObject //in the .h
@property (readwrite, strong) NSData *fileData;
@end
@implementation MyClass //in the .m
- (void) openFile:(NSString *)pathToFile {
self.fileData = [NSData dataWithContentsOfFile:pathToFile];
}
- (void) convertFile {
//whatever you wanted to do to self.fileData
}
@end