As I work my way through the book and the challenges, I often find myself off on some detour to really try and understand what Hillegass means...and this is one of them.
In order to do challenge 18, the one with the ovals and document architecture, I found myself looking at Apple's Sketch...which leads me to this question....which I have not been able to find asked elsewhere.
So, there are 2 parts to the query....which in all likelihood are intimately related.
One of the classes gave me an error. I had added a macro to the class so I could see what method was being called. Soon realized, that the macro, which worked in every other case, did not work **if** the method was **Outside** of an @implementation....end block. Like so....
and
So, my 2 questions are this.
1) **Why** did the writer of the app choose to place the method **outside** of the implementation block?
2) Probably related to the above, why is the macro here ??out of scope?? if that indeed is the problem.
Thanks as always
In order to do challenge 18, the one with the ovals and document architecture, I found myself looking at Apple's Sketch...which leads me to this question....which I have not been able to find asked elsewhere.
So, there are 2 parts to the query....which in all likelihood are intimately related.
One of the classes gave me an error. I had added a macro to the class so I could see what method was being called. Soon realized, that the macro, which worked in every other case, did not work **if** the method was **Outside** of an @implementation....end block. Like so....
Code:
#import <AppKit/AppKit.h>
#define METHOD_LOG (NSLog(@"Method: %@ self = %@", \
NSStringFromSelector(_cmd), \
self))
@interface NSObject (SKTPerformExtras)
- (void)performSelector:....blah blah;
- (void)performSelector:(SEL)sel ....blah blah;
@end
NSRect SKTRectFromPoints(NSPoint point1, NSPoint point2);
and
Code:
#import "SKTFoundationExtras.h"
@implementation NSObject (SKTPerformExtras)
- (void)performSelector:(SEL)sel withEachObjectInArray:(NSArray *)array {
METHOD_LOG;
......more stuff
}
}
@end
NSRect SKTRectFromPoints(NSPoint point1, NSPoint point2) {
METHOD_LOG; //<<<error
return NSMakeRect(((point1.x <= point2.x) ? point1.x : point2.x), ((point1.y <= point2.y) ? point1.y : point2.y), ((point1.x <= point2.x) ? point2.x - point1.x : point1.x - point2.x), ((point1.y <= point2.y) ? point2.y - point1.y : point1.y - point2.y));
}
So, my 2 questions are this.
1) **Why** did the writer of the app choose to place the method **outside** of the implementation block?
2) Probably related to the above, why is the macro here ??out of scope?? if that indeed is the problem.
Thanks as always