[AC-5360] Swift framework
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Duplicate |
Resolution Date | 2017-11-12T12:07:33.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Hyperloop |
Labels | ios |
Reporter | Igor Stojanovic |
Assignee | Shak Hossain |
Created | 2017-11-08T19:36:50.000+0000 |
Updated | 2019-05-28T13:48:57.000+0000 |
Description
1. Created simple swift framework testFr.framework. Framework is tested from other test Xcode project and it works.
2. Pasted testFr.framework to app/platform/ios directory
3. Required for framework class from index.js file.
var MyView = require("testFr/MyView"); // this line is passed and "something is created"
Ti.API.info("CLASS ", MyView); // this MyView object has value :
var view = new MyView(); // FAILED
$.index.add(view);
4. Get this error:
[ERROR] : Cannot find class with name: MyView
[ERROR] : Script Error {
[ERROR] : column = 32;
[ERROR] : description = "Cannot find class with name: MyView";
[ERROR] : line = 101;
[ERROR] : message = "Cannot find class with name: MyView";
[ERROR] : name = ClassNotFound;
[ERROR] : nativeStack = "1 libobjc.A.dylib 0x0000000184a84528 objc_exception_throw + 56\n2 testHyperloop 0x0000000102b66e74 testHyperloop + 4337268\n3 testHyperloop 0x0000000102b600d0 testHyperloop + 4309200\n4 testHyperloop 0x000000010295663c testHyperloop + 2172476\n5 testHyperloop 0x00000001029fc2dc testHyperloop + 2851548\n6 testHyperloop 0x0000000102a02218 testHyperloop + 2875928";
[ERROR] : sourceURL = "file:///var/containers/Bundle/Application/9683EB85-028C-46DD-8552-5A340974E8ED/testHyperloop.app/hyperloop/testfr/myview.js";
[ERROR] : stack = "createProxy@[native code]\n$initialize@file:///var/containers/Bundle/Application/9683EB85-028C-46DD-8552-5A340974E8ED/testHyperloop.app/hyperloop/testfr/myview.js:101:32\nMyView@file:///var/containers/Bundle/Application/9683EB85-028C-46DD-8552-5A340974E8ED/testHyperloop.app/hyperloop/testfr/myview.js:24:14\nController@file:///var/containers/Bundle/Application/9683EB85-028C-46DD-8552-5A340974E8ED/testHyperloop.app/alloy/controllers/index.js:1:1199\ncreateController@file:///var/containers/Bundle/Application/9683EB85-028C-46DD-8552-5A340974E8ED/testHyperloop.app/alloy.js:1:4894\nglobal code@file:///var/containers/Bundle/Application/9683EB85-028C-46DD-8552-5A340974E8ED/testHyperloop.app/app.js:1:574";
[ERROR] : }
5. Checked file myView.js generated by hyperloop and it crash at this line:
$class = Hyperloop.createProxy({
class: 'MyView',
alloc: false,
init: 'class'
});
Attachments
[~jvennemann] Can you try to reproduce this? Thanks!
Pure Swift framework (without the public Objective-C header) are not supported so far. They require a different way of parsing and are tracked in TIMOB-24163.
I'm having a similar issue with GiphyCoreSDK, a Swift framework which has a public objective C header.
[~rlustemberg] If you're flexible, you can use the pure native Swift module support coming in SDK 8 (already merged and stable) to even use frameworks that do not have any Obj-C relation.
I'll test with SDK 8. In any case the GiphyCoreSdk is just a wrapper for an http client to their REST API. I can even skip the framework altogether, and use the Ti http client. But I'll test with SDK 8 anyway. The framework does work if I call it from within a native module (SDK 7.5), there are no issues once I import the umbrella header.
It fails as well :( . The classes on the umbrella header are not available to hyperloop
Please note that I don't mean Hyperloop and SDK 8. I mean a native module (ti create -t module) where you can select "Swift" or "Obj-C" now.