[Bug report] Unable to build demo project if imported swift framework turned on BUILD_LIBRARY_FOR_DISTRIBUTION

So we are an open source DGCharts project based on Swift.

I found that with DGCharts framework target itself enabling of BUILD_LIBRARY_FOR_DISTRIBUTION, the ChartsDemo-iOS demo won't build, complaining not able to find XYMarkerView and similar MarkerView implemented in the demo project.
image

however ChartsDemo-Swift has no such issue.

This BUILD_LIBRARY_FOR_DISTRIBUTION is weird.

I see "ChartsDemo_iOS-Swift.h" has generated signature for LargeValueFormatter, which is simply in another folder under ChartsDemo-iOS project, but the RadarMarkerView is completely missing.

// Generated by Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51) SWIFT_CLASS("_TtC14ChartsDemo_iOS19LargeValueFormatter") @interface LargeValueFormatter : NSObject <ChartAxisValueFormatter, ChartValueFormatter>

Steps to reproduce:
latest Xcode

  1. clone GitHub - danielgindi/Charts: Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart., branch release/5.0.0

  2. simply open Charts.xcworkspace, choose ChartsDemo-iOS target, note this is the Objc demo.

  3. hit build, it will fail saying /Charts/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m:98:5 Use of undeclared identifier 'XYMarkerView' and similar

  4. turn off DGChart framework BUILD_LIBRARY_FOR_DISTRIBUTION, and it will build fine.

  5. however ChartsDemo-Swift has no such issue no matter what.

there are two XYMarkView, though one for Objc one for Swift. It has been adjusted in
image

Please advice how to fix the demo to build.

I don't know why LargeValueFormatter is seen but the other MarkViews are missing.

The Charts.xcworkspace already contains everything, the Charts project. So basically it should build well
image

After turning off Charts framework BUILD_LIBRARY_FOR_DISTRIBUTION,
the "ChartsDemo_iOS-Swift.h" indeed has generated all swift classes:

#if defined(__OBJC__)
@class UIColor;
@class UIFont;
@class ChartDataEntry;
@class ChartHighlight;
@class NSString;

SWIFT_CLASS("_TtC14ChartsDemo_iOS13BalloonMarker")
@interface BalloonMarker : ChartMarkerImage
@property (nonatomic, strong) UIColor * _Nonnull color;
@property (nonatomic) CGSize arrowSize;
@property (nonatomic, strong) UIFont * _Nonnull font;
@property (nonatomic, strong) UIColor * _Nonnull textColor;
@property (nonatomic) UIEdgeInsets insets;
@property (nonatomic) CGSize minimumSize;
- (nonnull instancetype)initWithColor:(UIColor * _Nonnull)color font:(UIFont * _Nonnull)font textColor:(UIColor * _Nonnull)textColor insets:(UIEdgeInsets)insets OBJC_DESIGNATED_INITIALIZER;
- (CGPoint)offsetForDrawingAtPoint:(CGPoint)point SWIFT_WARN_UNUSED_RESULT;
- (void)drawWithContext:(CGContextRef _Nonnull)context point:(CGPoint)point;
- (void)refreshContentWithEntry:(ChartDataEntry * _Nonnull)entry highlight:(ChartHighlight * _Nonnull)highlight;
- (void)setLabel:(NSString * _Nonnull)newLabel;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end

@class ChartAxisBase;
@class ChartViewPortHandler;

SWIFT_CLASS("_TtC14ChartsDemo_iOS19LargeValueFormatter")
@interface LargeValueFormatter : NSObject <ChartAxisValueFormatter, ChartValueFormatter>
/// Suffix to be appended after the values.
/// <em>default</em>: suffix: [“”, “k”, “m”, “b”, “t”]
@property (nonatomic, copy) NSArray<NSString *> * _Nonnull suffix;
/// An appendix text to be added at the end of the formatted value.
@property (nonatomic, copy) NSString * _Nullable appendix;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithAppendix:(NSString * _Nullable)appendix OBJC_DESIGNATED_INITIALIZER;
- (NSString * _Nonnull)stringForValue:(double)value axis:(ChartAxisBase * _Nullable)axis SWIFT_WARN_UNUSED_RESULT;
- (NSString * _Nonnull)stringForValue:(double)value entry:(ChartDataEntry * _Nonnull)entry dataSetIndex:(NSInteger)dataSetIndex viewPortHandler:(ChartViewPortHandler * _Nullable)viewPortHandler SWIFT_WARN_UNUSED_RESULT;
@end

@class UILabel;
@class NSCoder;

SWIFT_CLASS("_TtC14ChartsDemo_iOS15RadarMarkerView")
@interface RadarMarkerView : ChartMarkerView
@property (nonatomic, strong) IBOutlet UILabel * _Nullable label;
- (void)awakeFromNib;
- (void)refreshContentWithEntry:(ChartDataEntry * _Nonnull)entry highlight:(ChartHighlight * _Nonnull)highlight;
- (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
@end


SWIFT_CLASS("_TtC14ChartsDemo_iOS12XYMarkerView")
@interface XYMarkerView : BalloonMarker
@property (nonatomic, strong) id <ChartAxisValueFormatter> _Nullable xAxisValueFormatter;
- (nonnull instancetype)initWithColor:(UIColor * _Nonnull)color font:(UIFont * _Nonnull)font textColor:(UIColor * _Nonnull)textColor insets:(UIEdgeInsets)insets xAxisValueFormatter:(id <ChartAxisValueFormatter> _Nonnull)xAxisValueFormatter OBJC_DESIGNATED_INITIALIZER;
- (void)refreshContentWithEntry:(ChartDataEntry * _Nonnull)entry highlight:(ChartHighlight * _Nonnull)highlight;
- (nonnull instancetype)initWithColor:(UIColor * _Nonnull)color font:(UIFont * _Nonnull)font textColor:(UIColor * _Nonnull)textColor insets:(UIEdgeInsets)insets SWIFT_UNAVAILABLE;
@end

#endif
#if defined(__cplusplus)
#endif
#if __has_attribute(external_source_symbol)
# pragma clang attribute pop
#endif
#pragma clang diagnostic pop
#endif

#else
#error unsupported Swift architecture
#endif

comparing to when the option is on:

#if defined(__OBJC__)
#if __has_feature(modules)
#if __has_warning("-Watimport-in-framework-header")
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
#endif
@import DGCharts;
@import Foundation;
@import ObjectiveC;
#endif

#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
#if __has_warning("-Wpragma-clang-attribute")
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
#endif
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wnullability"
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"

#if __has_attribute(external_source_symbol)
# pragma push_macro("any")
# undef any
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="ChartsDemo_iOS",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
# pragma pop_macro("any")
#endif

#if defined(__OBJC__)
@class NSString;
@class ChartAxisBase;
@class ChartDataEntry;
@class ChartViewPortHandler;

SWIFT_CLASS("_TtC14ChartsDemo_iOS19LargeValueFormatter")
@interface LargeValueFormatter : NSObject <ChartAxisValueFormatter, ChartValueFormatter>
/// Suffix to be appended after the values.
/// <em>default</em>: suffix: [“”, “k”, “m”, “b”, “t”]
@property (nonatomic, copy) NSArray<NSString *> * _Nonnull suffix;
/// An appendix text to be added at the end of the formatted value.
@property (nonatomic, copy) NSString * _Nullable appendix;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithAppendix:(NSString * _Nullable)appendix OBJC_DESIGNATED_INITIALIZER;
- (NSString * _Nonnull)stringForValue:(double)value axis:(ChartAxisBase * _Nullable)axis SWIFT_WARN_UNUSED_RESULT;
- (NSString * _Nonnull)stringForValue:(double)value entry:(ChartDataEntry * _Nonnull)entry dataSetIndex:(NSInteger)dataSetIndex viewPortHandler:(ChartViewPortHandler * _Nullable)viewPortHandler SWIFT_WARN_UNUSED_RESULT;
@end

#endif
#if defined(__cplusplus)
#endif
#if __has_attribute(external_source_symbol)
# pragma clang attribute pop
#endif
#pragma clang diagnostic pop
#endif

#else
#error unsupported Swift architecture
#endif