FlickrKit icon indicating copy to clipboard operation
FlickrKit copied to clipboard

Port FlickrKit to OS X

Open randomsequence opened this issue 12 years ago • 2 comments

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

randomsequence avatar Nov 17 '13 17:11 randomsequence

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.

devedup avatar Nov 19 '13 09:11 devedup

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.

randomsequence avatar Nov 20 '13 14:11 randomsequence