Cannot find interface declaration for 'ChartXAxisRenderer' when subclassing XAxisRenderer
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
> ℹ Please fill out this template when filing an issue.
> All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.
>
> Per our [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md), we use GitHub for
> bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag [`ios-charts`.](https://stackoverflow.com/questions/tagged/ios-charts)
>
> Please remove this line and everything above it before submitting.
* [x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).
## What did you do?
I have added Charts to an iOS swift project with SPM. I am able to create charts without any issues. I want to subclass the XAxisRenderer class to customise the limit line label like shown below.
```
class CustomRenderer: XAxisRenderer {
override func renderLimitLineLabel(context: CGContext, limitLine: ChartLimitLine, position: CGPoint, yOffset: CGFloat) {
// My changes
ChartUtils.drawText(
context: context,
text: label,
point: point,
align: align,
attributes: attributes
)
}
}
```
So that I can then apply it to my LineChart like:
```
self.lineChart.xAxisRenderer = CustomRenderer(
viewPortHandler: self.lineChart.viewPortHandler,
xAxis: self.lineChart.xAxis,
transformer: self.lineChart.getTransformer(forAxis: .left)
)
```
## What did you expect to happen?
I can subclass the XAxisRenderer and pass it to my chart. I do have a bridging header file because I have some objective-c view controllers in the swift project. I have also marked "Always Embed Swift Standard Libraries" under build options. I researched and didn't see any issues like the one I am facing. I have a feeling it's something I missed but I am unable to find the cause.
## What happened instead?
However subclassing causes the build to fail with the following error...


## Charts Environment
**Charts version/Branch/Commit Number:** 3.5.0
**Xcode version:** Version 11.5 (11E608c)
**Swift version:** 5
**Platform(s) running Charts:** iOS
**macOS version running Xcode:** -
Contributor guide
Assessment
This issue has not been assessed yet.