Support Topics Documentation Slack YouTube Blog

How to make a query using Swift?


(Hillary Chipunza) #1

I am coming from Parse and I would like to populate a tableview from a column of ‘car names’ in my database called “Cars” for example using swift code. How do i populate the cars in swift code? We need full on documentation supporting swift implementation.


(Mark Piller) #2

You should use the API documented here:

https://backendless.com/documentation/data/ios/data_basic_search.htm
It contains Swift signatures and examples.


(Hillary Chipunza) #3

The API is as good as useless. Everytime i try add my class there it gives me a red line to say my class is undefined. I tried placing " " around it but i get an error from the terminal:Server reported an error: Optional(FAULT = ‘2024’ [Wrong entity name: name must not have a symbol ‘.’] <Wrong entity name: name must not have a symbol ‘.’> )

Please can you give me sample code in your own typing to retirieve objects from a table.


(Hillary Chipunza) #4

Check my attached screenshot, i got the method from


(Hillary Chipunza) #5

I tried another example of yours and It still complains on the class name. Please find attached


(Mark Piller) #6

Obviously you didn’t read the doc I gave you the link for. If you did, you’d see this:

http://support.backendless.com/public/attachments/91c03ddbbbe74c36618eadec48d45785.png</img>

I understand some people prefer to code by example. Well, the example is right there. You missed it there again. Here’s the full source for the example you mentioned:

You can see that the Restaurant class is defined in Restaurant.swift.


(Vyacheslav Vdovichenko) #7

You should declare your Songs class outside another classes of your target (maybe in separate swift file)


(Hillary Chipunza) #8

My apologies I misread that! I thought the name of the class they meant there was the name of my Table on Backendless and that’s all. Things are done very differently in Parse and I must say its a rough transition but I get it now. Thank you!! :slight_smile:


(Hillary Chipunza) #9

Thank you! Makes so much sense now :slight_smile:


(Vyacheslav Vdovichenko) #10

Can you clone the whole BlogFeatureDay-iOS workspace, then try F16RetrievingDataSwift project there. I just check this sample (with included appID & secretKey ), it works fine for me, see a log:
http://support.backendless.com/public/attachments/0b7d8070889e60a7cfaf6cd2949228fc.png</img>

Regards,
Slava


(Hillary Chipunza) #11

Thank you Slava let me do so :slight_smile: