All Projects → supabase-community → postgrest-swift

supabase-community / postgrest-swift

Licence: MIT License
Swift client for PostgREST

Programming Languages

swift
15916 projects
Makefile
30231 projects

Projects that are alternatives of or similar to postgrest-swift

postgrest-csharp
A C# Client library for Postgrest
Stars: ✭ 62 (+169.57%)
Mutual labels:  postgrest, supabase
Supabase
The open source Firebase alternative. Follow to stay updated about our public Beta.
Stars: ✭ 25,142 (+109213.04%)
Mutual labels:  postgrest, supabase
LunaDesk
The people-first scheduling tool, coming 2022. LunaDesk is a web app, originally created by Josh Cawthorne and known as "WorkFrom" for the Supabase Hackathon.
Stars: ✭ 85 (+269.57%)
Mutual labels:  supabase
supabase
An easy way to integrate Supabase with NuxtJS
Stars: ✭ 39 (+69.57%)
Mutual labels:  supabase
supabase flutter
Using Supabase in Flutter
Stars: ✭ 38 (+65.22%)
Mutual labels:  supabase
frisson
Modern Java web application starter template.
Stars: ✭ 61 (+165.22%)
Mutual labels:  supabase
nuxt-supabase
A supa simple wrapper around Supabase.js to enable usage within Nuxt.
Stars: ✭ 146 (+534.78%)
Mutual labels:  supabase
ra-data-postgrest
react admin client for postgREST
Stars: ✭ 80 (+247.83%)
Mutual labels:  postgrest
madewithsupabase
A collection of projects made with Supabase – Websites, Mobile Apps, SaaS, Plugins and more!
Stars: ✭ 84 (+265.22%)
Mutual labels:  supabase
ds-visualizer
This is an ongoing project based on data structures. We will be presenting and explaining the code of each basic data structure with the help of a visualizer.
Stars: ✭ 14 (-39.13%)
Mutual labels:  supabase
supabase-ui-svelte
Supabase authentication UI for Svelte
Stars: ✭ 83 (+260.87%)
Mutual labels:  supabase
docker-postgrest
REST API for any Postgres database (PostgREST Docker Image)
Stars: ✭ 22 (-4.35%)
Mutual labels:  postgrest
gotrue
A JWT based API for managing users and issuing JWT tokens
Stars: ✭ 325 (+1313.04%)
Mutual labels:  supabase
realtime-csharp
A C# client library for supabase/realtime.
Stars: ✭ 35 (+52.17%)
Mutual labels:  supabase
easypastes
Use Easy Pastes to create, store, share code snippets by simply pasting them with syntax highlight.
Stars: ✭ 34 (+47.83%)
Mutual labels:  supabase
react-supabase
React Hooks library for Supabase
Stars: ✭ 168 (+630.43%)
Mutual labels:  supabase
tip-tweet
Tip Tweet is a hybrid dApp that provides a simple way to tip a tweet using Ethereum. Authors can claim their tips using their Twitter account. You only need the tweet URL to tip. 🚀 😎
Stars: ✭ 23 (+0%)
Mutual labels:  supabase
simple-rest-api
😎 A simple RESTful API in three easy steps.
Stars: ✭ 25 (+8.7%)
Mutual labels:  postgrest
godot-engine.supabase
A lightweight addon which integrates Supabase APIs for Godot Engine out of the box.
Stars: ✭ 39 (+69.57%)
Mutual labels:  supabase
supaflare
URL shortener / redirection service powered by Supabase, Cloudflare Workers, Workers KV and Cloudflare Pages.
Stars: ✭ 51 (+121.74%)
Mutual labels:  supabase

Postgrest Swift

Installation

Swift client for PostgREST. The goal of this library is to make an "ORM-like" restful interface.

Swift Package Manager

Add postgrest-swift as a dependency to your Package.swift file. For more information, please see the Swift Package Manager documentation.

.package(url: "https://github.com/supabase/postgrest-swift", .exact("0.0.1"))

Supabase

You can also install the supabase-swift package to use the entire supabase library.

Usage

import Foundation
import PostgREST

let supabaseUrl = ""
let supabaseKey = ""

var database = PostgrestClient(
    url: "\(supabaseUrl)/rest/v1",
    headers: ["apikey": supabaseKey],
    schema: "public")

let semaphore = DispatchSemaphore(value: 0)

struct Todo: Codable {
    var id: Int?
    var task: String?
    var completed: Bool?
}

database.from("todo").select().execute { result in
    switch result {
    case let .success(response):
        do {
            let todos = try response.decoded(to: [Todo].self)
            print(todos)
        } catch {
            print(error.localizedDescription)
        }
    case let .failure(error):
        print(error.localizedDescription)
    }
}

do {
    let todo = Todo(task: "fix some issues in postgrest-swift", completed: true)
    let jsonData: Data = try JSONEncoder().encode(todo)

    database.from("todo").insert(values: jsonData).execute { result in
        switch result {
        case let .success(response):
            do {
                let todos = try response.decoded(to: [Todo].self)
                print(todos)
            } catch {
                print(error.localizedDescription)
            }
        case let .failure(error):
            print(error.localizedDescription)
        }
    }

} catch {
    print(error.localizedDescription)
}

semaphore.wait()

Contributing

  • Fork the repo on GitHub
  • Clone the project to your own machine
  • Commit changes to your own branch
  • Push your work back up to your fork
  • Submit a Pull request so that we can review your changes and merge

License

This repo is liscenced under MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].