FlickrKit
FlickrKit copied to clipboard
Port FlickrKit to OS X
Initial port to the Mac. Note the tests don't work (though they don't seem to work on iOS either).
Ref devedup/FlickrKit#2
Cool, I like this. Thanks.
I've never done a Mac port before. Is it really necessary to have the if/else for the whole methods when at times the only difference is one class: i.e. NSImage or UIImage.
Wouldn't it be more succinct to instead create a typedef: e.g.
#if TARGET_OS_IPHONE typedef UIImage DUImage; #elif TARGET_OS_MAC typedef NSImage DUImage #endif
This way you wouldn't have so much duplicated code, and it would be slightly easier to read and maintain.
Yes, I've used that approach too. Personally I find the system types easier to scan. The methods on each aren't identical (or even close), so you'll still be using pre-processor conditions wherever you try to do anything with them.
I actually went back after this and added a new method to upload an image directly from a file (randomsequence/FlickrKit@015c70524f124b04a411e99f929320075cc8706e). Perhaps the best approach is to make that the default implementation and create OS specific categories for each platform's image type.