Re: Common Date between Swift and ObjC
Re: Common Date between Swift and ObjC
- Subject: Re: Common Date between Swift and ObjC
- From: Jeff Kelley <email@hidden>
- Date: Tue, 12 Aug 2014 13:52:55 -0400
Gerriet,
You should be able to make a constant variable, not a preprocessor
definition, and import the file that declares it in your project’s bridging
header. Something like this:
in Constants.h:
extern const NSInteger kParameterA;
in Constants.m:
const NSInteger kParameterA = 17;
Then, in your bridging header, you’d import Constants.h.
Jeff Kelley
email@hidden | @SlaunchaMan <https://twitter.com/SlaunchaMan> |
jeffkelley.org
On Tue, Aug 12, 2014 at 1:47 PM, Gerriet M. Denkmann <email@hidden>
wrote:
> In ObjC I used to do:
> CommonDefines.h
> #define PARAMETER_A 17
> and then import CommonDefines.h into all files which have to know this
> parameter.
>
> But how do I make a Swift file and an ObjC file both aware of the value of
> PARAMETER_A?
>
> Keeping both in sync is rather error prone; I much rather have the value
> in only one place (like my CommonDefines.h).
>
> Gerriet.
_______________________________________________
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