0
votes

This seems like a basic request, but I can't find the answer to it anywhere. I want to wrap some existing iOS code that I wrote, in a Appcelerator module. That's it. Important points:

  1. I am NOT wrapping a pre-existing 3rd party iOS SDK.
  2. I wrote the iOS code being wrapped.
  3. Code is verified as working within xcode.
  4. There are no .a files. There are 2x .h files and 2x .m files though.
  5. There are no UI elements in the iOS code as it is only designed to connect the native bluetooth hardware to the app.
  6. I have created a generic appcelerator iOS module project, built it, and successfully called the generic ID function within my app.
  7. I cannot figure out how to successfully edit the generic module so that it utilizes my code. Every attempt results in it refusing to compile, and it's maddening.
  8. I do not have access to Hyperloop.

Once I can successfully build the wrapped module, I would call an initialization function which triggers a native bluetooth hardware search. Once connected, there are functions within the module to send commands to the hardware and receive data back. This is the official documentation I've followed so far:

http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Quick_Start

That helped me build the blank module, include it in the app, and ensure that it worked by calling the built in test property. From there it stops short of actually telling me what I need to know. These are the closest things I've found so far, while still not being what I need:

  1. http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Project-section-43288810_iOSModuleProject-AddaThird-PartyFramework
  2. appcelerator module for existing ios project sdk

Heck, I still don't even know if I can do this within studio or if I have to edit the generic module in Xcode. Help! :) Many thanks in advance.

1

1 Answers

1
votes

so first of all, this is not best practice and will cause possible problems in the future when the SDK changes and your module still relies on outdated core API's.

Regarding your question, you could either create a new component that subclasses the existing class, e.g.

class TiMyModuleListViewProxy : TiUiListViewProxy {

}

and call it with

var myList = MyModule.createListView();

or you write a category to extend the existing API with your own logic, e.g.

@interface TiUIListViewProxy (MyListView)

- (void)setSomethingElse:(id)value;

@end

@implementation TiUIListViewProxy (MyListView)

- (void)setSomethingElse:(id)value
{
    // Set the value of "somethingElse" now
}

@end

I would prefer the second option since it matches a better Objective-C code-style, but please still be aware of the possible core-changes that might effect your implementation in the feature. Thanks!