0

When I write this in the constant.h file:

#define WS_PLANNING_INFORMATION "registrations/"

It works when I call it from the Swift file.

But if I write this in the constant.h file:

#define WS_PLANNING_INFORMATION "registrations/" CRYPTOKEY

It doesn't work. The swift file doesn't see the WS_PLANNING_INFORMATION anymore.

Is there an easy way to concatenate two strings in the constant.h file to be well-retrieved by the swift file?

(The validate answer to this question is very useful and more simple than in that ticket, that doesn't suit me)

ΩlostA
  • 2,501
  • 5
  • 27
  • 63

1 Answers1

2

Use constants instead of macros.

in constant.h

extern const char *WS_PLANNING_INFORMATION;

in constant.m

const char *WS_PLANNING_INFORMATION = "registrations/" CRYPTOKEY;

If you mean to use NSString * instead of char *

in constant.h

extern const NSString *WS_PLANNING_INFORMATION;

in constant.m

const NSString *WS_PLANNING_INFORMATION = @"registrations/" CRYPTOKEY;
Jeffery Thomas
  • 42,202
  • 8
  • 92
  • 117