Closed NathanaelA closed 4 years ago
@mbektchiev - I finally decided to try the trick in #710 and that allowed me access to the WRITABLE data
parameter property on the ChartViewBase.
No matter how I tried to create a new property or function (in the base ChartViewBase or the final LineChartView class); they all showed up properly in the .ts/.yaml files; but at actual run time they were missing and either crashed or threw the binding error listed above... (Closed Issue 1221 actually has all the class hiarchy information if you need to see it)
@NathanaelA I couldn't reproduce the missing setDataWithLineData
function. After taking the CocoaPod and adding this code:
let LC = LineChartView.alloc().initWithFrame(CGRectMake(0,0,100,100));
for (let key in LC) {
if (key.indexOf("setD") >= 0) {
console.log("Key:", key);
}
}
console.log(LC.constructor.name);
console.log(LC.setDataWithLineData);
LC.setDataWithLineData(LineChartData.new());
I received the following output without any crashes or errors:
CONSOLE LOG file:///src/app/item/items.component.ts:22:32: Key: setDataWithLineData
CONSOLE LOG file:///src/app/item/items.component.ts:22:32: Key: setDragOffsetX
CONSOLE LOG file:///src/app/item/items.component.ts:22:32: Key: setDragOffsetY
CONSOLE LOG file:///src/app/item/items.component.ts:22:32: Key: setDataWithChartData
CONSOLE LOG file:///src/app/item/items.component.ts:26:24: Charts.LineChartView
CONSOLE LOG file:///src/app/item/items.component.ts:27:24: function setDataWithLineData() {
[native code]
}
I'll try and post a repo demo with the different crashes after JSMobileConf....
That is really weird that you got setDataWithLineData
in your keys, mine didn't show it, nor any of the other metadata pieces that I needed... My final solution was actually using the #710 trick to access and write the data
parameter. All my other attempts at accessing my own added functions like setDataWithLineData
would crash or throw an error.
@NathanaelA I've just merged the PR. You can test whether everything's been fixed using tns platform add ios@next
.
I'll run some more tests...
Environment
Describe the bug Most the metadata issues are fixed with the PR #1218 that @mbektchiev did, awesome work -- Generating the metadata shows the data; and several functions that were broken before are now accessible.
However it seems that most functions with a parameter are still broken inside NativeScript; however the MetaData generator does see them. Example:
I added a swift function:
The metadata.yaml and TS file; both show that the function is named
setDataWithLineData
TS file created: YAML:However, attempting to call it from NS gives me this:
So somehow the metadata generator when creating TS/YAML sees it and puts it into the files, but NS while running can't find it.
To Reproduce Create a pod using this commit:
pod 'Charts', :git => 'https://github.com/nstudio/Charts', :commit => '2a297cfaada81140664d119a34b159db7f5b7b0d'
And add it to your program. let LC = LineChartView.alloc().initWithFrame(CGRect(0,0,100,100)); for (let key in LC) { if (key.indexOf("setD") >= 0) console.log("Key:", key); } You will see it doesn't show up in the keys; if you attempt to call it -- it will give you the binding error.
Please note their are a couple other meta data bugs also that seem related.
data
parameter is not writable from NS, from objc it is.Also does not show up in the function list keys in NS, nor is callable.
Expected behavior Meta Data fully works.... :D
Additional context Related to #1221