Xcode8: would like a preprocessor symbol when building a generated interface

Originator:markd
Number:rdar://27195567 Date Originated:7/6/2016
Status:Open Resolved:
Product:Developer Tools Product Version:Version 8.0 beta 2 (8S162m)
Classification:Enhancement Reproducible:N/A
 
Summary:
I was in the process of answering https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20160704/002488.html

Which fundamentally boils down to "I would like some things visible to Swift, and other things I can hide from it.

It's possible to do something like


Project-Bridging-Header.h

...
#define SUPPRESS_OLD_FOOD 1
#import "Foodies.h"


Foodies.h

typedef NS_OPTIONS(NSInteger, FoodType)
{
    FoodDairy = 1 << 0,
    FoodMeat = 1 << 1,
    FoodMushroom = 1 << 2,

#if !SUPPRESS_OLD_FOOD
// Old names
dairyFood = FoodDairy,
meatFood = FoodMeat,
mushroomFood = FoodMushroom
#endif
};


With the Bridging header, but Xcode doesn't seem to process "Generated Interface" by using the Bridging header (it shows the old and new names and doesn't simplify the Food* names), so now there's got two versions of the final generated header - the one Xcode will show you, and the one actually used by Swift.

I figure always using the Project-Bridging-Header.h when building the generated preview is a non-starter, just from a performance / general sanity point of view.

What I really want is a predefined macro that's only set during header generation that we can query to gate things like "this junk is purely for objective-C, it's better if Swift's generated headers doesn't even know it exists.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!