Objective-C Help: User Data

Hello,
I’m looking into creating a better API for one of my classes I have created in Objective C. Right now, I have the user create the object, which returns an ID, which the user can then use to change the object around with that ID. What I would like to do is similar to what @Simeon has done with things like images. It seems to hold a UIImage, yet from my research on creating user data in C, I don’t know how.
Any help would be wonderful.
Thank you!
Edit: I think I’m misusing the term “user data” for what I want to do, but I’m just going to use that to get my point across.

I’ve only sent images the other way, like here https://gist.github.com/tnlogy/5371725

But since the runtime is a black box I guess you have to try ripping code out from the old runtime and hope that the data looks the same. Here is the function that convert an UIImage to something Codea recognize:
https://github.com/TwoLivesLeft/Codea-Runtime/blob/bd35788ac6f8450f480aca3e4ee2ef347c5bee2a/CodeaTemplate/LuaLibs/image.m#L310

I guess you need to copy all the function that it refer to as well. Good luck with the black box :slight_smile:

@tnlogy - I’ve done the same thing. That was a very helpful example for some of my code. It just struck me I might as well look at the beta runtime when it was open source. duh
Thanks!

But for you maybe it is easier to return an id, and keep a id to object data dictionary in the Objective C code instead, or what is the user data, anything that you will manipulate directly in Codea?

@tnlogy - I’m finally getting around to creating that Objective-C Coco UI library.
Edit: I’m going to stick with IDs just because it’d so much more work, just to fulfill that tiny bit of OCD in the back of my brain.

ah, rereading your post I see that you are using id’s instead of userdata. :slight_smile:

oh, hope you will share it, and that Apple will allow it. :slight_smile:

@tnlogy - Right now, I’m actually sticking with web views because that’s what I need, but I’ll probably add the whole spazzaz and all the UI elements after v1.1. :slight_smile:

Since I didn’t want to put 2 threads about Objective C, I’m going to add this here too: [self.codeaViewController addSubview:webView]; does not seem to work. addSubview does not exist. Is there another variable I can use to add sub views, or is this possible?
Thanks!
Edit: Duh. I forgot to to use [self.codeaViewController.view addSubview:webView]; instead.