Re: predefined macro iOS vs OS X
Re: predefined macro iOS vs OS X
- Subject: Re: predefined macro iOS vs OS X
- From: Maxthon Chan <email@hidden>
- Date: Sun, 18 Aug 2013 00:03:01 +0800
I actually got one step (sorry for the pun) ahead as limited to what Cocoa’s Foundation and GNUstep’s Base have in common. That allows me to create code-compatible programs that builds and runs under both OS X (or iOS) and Linux. (In my company everything starts off in Objective-C and now with this limitation the porting cost is dropping drastically.)
Example: CGIKit: https://github.com/xcvista/CGIKit (a FastCGI library for Objective-C, CGIKit.xcodeproj will build on OS X with embedded libfcgi and GNUmakefile will build on Linux with GNUstep with external libfcgi.)
On Aug 17, 2013, at 23:52, Marcel Weiher <email@hidden> wrote:
>
> On Aug 16, 2013, at 19:04 , Kyle Sluder <email@hidden> wrote:
>
>> On Aug 16, 2013, at 12:41 PM, "Gerriet M. Denkmann" <email@hidden> wrote:
>>> On 16 Aug 2013, at 22:59, Kyle Sluder <email@hidden> wrote:
>>>> Xcode does know this. But if you're building for 32-bit OS X, it will correctly complain.
>>>
>>> When I build for Mac OS X CGRect is accepted.
>>> But when I build for iOS then NSRect creates "Use of undeclared identifier "NSRect" did you mean "NSSet""
>>
>> Stop using NSRect in your method prototypes and just use CGRect.
>
>
> This is certainly pragmatic, effective advice.
>
> <PetPeeve>
>
> However…if you care as much about dependency management as I do (and chances are you don’t), and don’t have a direct dependency on CoreGraphics in that code (and chances are you do), then this is slightly stomach-churning, in addition to pragmatic and effective.
>
> Pulling in a dependency on CoreGraphics just to get those types is awful, in addition it makes it harder to make code that works on both Mac OS X and iOS. After going back and forth on this for quite some time, I decided to standardize on the Foundation types and have a tiny compatibility layer, which you can find on github: https://github.com/mpw/MPWFoundation/blob/master/Classes/PhoneGeometry.h
>
> </PetPeeve>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden