IOS Swift Data Retrieving

Hey, any and all help is well appreciated.

So, I’ve got the usual users table with a column called friends which is a one to many relations, it relates to other users in the users table. I was wondering how I would go about retrieving the friends and then their individual properties such as username, name and email etc.

Thanks in advance

You should investigate this doc. Also you could try a sample project (in attachment). Load it with TestUserService.xcworkspace.

TestUserRelations.zip (19.26MB)

I’m working with swift here, the project files you gave me are Objective-C and I’ve gone through the documentation a few times prior and was hoping for a more personal guide. I’m new to database services and Swift itself, and since I’m 14, the documentation is somewhat difficult to understand due to me being new to this and young.

Again, thank you very much

Please see a swift project in attachment.

TestUserService.zip (19.28MB)

Okay, well I’ll go into detail in order to make it clearer for you as to what I want to accomplish. Basically I want to create a contacts page, and this will require getting all the users related to the current user, I then want to be able to display all the friends as a table and be able to click on the user and get all of their individual details. The problem is that when I do:

user.getProperty(“friends”)

It returns all the friends in an Array and I don’t know how to reference the individual friends and return their details. I suppose I should be doing a dataQuery with a whereClause? Help is well appreciated, or if you want to talk more personally that’s cool too.

Thanks a ton

When you say “It returns all the friends in an Array and I don’t know how to reference the individual friends”. Do you mean you do not know how to iterate over the array and use the individual objects in it?

Yes, pretty much. I want to be able to use the individual objects in the app. Like, each of the names for the friends. Thanks

Perhaps the following links will help:


Mark