supabase / supabase-swift

A Swift client for Supabase
https://supabase.com/docs/reference/swift
MIT License
720 stars 111 forks source link

No rows fetching in swift #582

Closed arslankaleem7229 closed 3 weeks ago

arslankaleem7229 commented 1 month ago

Bug report

Describe the bug

A clear and concise description of what the bug is.

I am using the documentation to fetch the rows from one of the item table, I have checked table has RLS disabled still Its not fetching anything from the database, If I am making the same curl request from Postman its returning the data but not from my IOS Simulator now I don't know why is this thing happening. Apart from that if I use this request from documentation it shows an error that .value returns Void

let items = try await supabase
                                .from("items")
                                .select()
                                .execute()
                                .value
arslankaleem7229 commented 1 month ago

Thanks to this solution this minor issue took the most of my time,

let items: [Item]? = try await supabase
                                .from("items")
                                .select()
                                .execute()
                                .value

This one question mark was the whole thing, This should be added to documentation

grdsdev commented 1 month ago

Hi, you have to cast the value to the desired Decodable type

Check docs: https://supabase.com/docs/reference/swift/select