ChartsOrg / ChartsOrg/Charts

Property `position` of `Description` inaccessible in Objective-C

Open
#1,889 3 comments 2 reactions 0 assignees View on GitHub
discussion idea
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

The property `position` in `Description` is defined as`open var position: CGPoint?`. Since `CGPoint` is a struct and not an object, this is not mappable to ObjC, and hence the property is not exposed by `ChartDescription` in the `Charts-Swift.h` bridging header.

I work around this by extending `Description` within my project to define a position setter on it:
`extension Description {
public func setPosition(to position: CGPoint) {
self.position = position
}
}`

This works, but it would be more elegant if you could add ObjC support for this property within the framework itself. On the other hand, I will understand if you regard this as 'collateral damage' in the process of Swift-ObjC interaction.

Contributor guide

Open the contributing guide

Research direction

Start with the position declaration on Description and inspect the generated Charts-Swift.h entry for ChartDescription. Reproduce the Objective-C import and compare it with the Swift extension workaround. Done means Objective-C consumers can access and set position through the framework without a project-local extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, swift
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.