All Projects → nicolasnascimento → SwiftAirtable

nicolasnascimento / SwiftAirtable

Licence: MIT license
An unofficial Swift interface to Airtable's REST API

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to SwiftAirtable

nikolovlazar.com
My personal site's repo built using Next.js, Chakra UI, MDX, Prisma, PlanetScale.
Stars: ✭ 126 (+152%)
Mutual labels:  airtable
vue-airtable-demo
Sample Vue.js / Webpack project with Airtable component.
Stars: ✭ 22 (-56%)
Mutual labels:  airtable
barnsworthburning
A commonplace book.
Stars: ✭ 20 (-60%)
Mutual labels:  airtable
airtable local backup
Create local backups of airtable databases
Stars: ✭ 32 (-36%)
Mutual labels:  airtable
nocodb
🔥 🔥 🔥 Open Source Airtable Alternative - turns any MySQL, Postgres, SQLite into a Spreadsheet with REST APIs.
Stars: ✭ 28,894 (+57688%)
Mutual labels:  airtable
airtable-node
Node API for Airtable without the bloat (lodash, etc)
Stars: ✭ 23 (-54%)
Mutual labels:  airtable
sourcery-templates
Building Vapor projects using meta programming with Sourcery ✨
Stars: ✭ 24 (-52%)
Mutual labels:  sourcery
airtable-app-mind-flow
MindFlow
Stars: ✭ 32 (-36%)
Mutual labels:  airtable
pocketcasts-stats
This project let's you fetch your Pocket Casts statistics and put them into Airtable with about 80 lines of code.
Stars: ✭ 12 (-76%)
Mutual labels:  airtable
Hiring Without Whiteboards
⭐️ Companies that don't have a broken hiring process
Stars: ✭ 25,494 (+50888%)
Mutual labels:  airtable
micro-airtable-api
Quickly make an API from Airtable
Stars: ✭ 30 (-40%)
Mutual labels:  airtable
airtabler
R interface to the Airtable API
Stars: ✭ 84 (+68%)
Mutual labels:  airtable
airtable-app-user-journal-map
An User Journal Map App of AirTable
Stars: ✭ 29 (-42%)
Mutual labels:  airtable
airtable
Airtable API Client for Go
Stars: ✭ 25 (-50%)
Mutual labels:  airtable
ember-airtable
Boilerplate for quickly prototyping apps with Airtable, Node & Ember
Stars: ✭ 21 (-58%)
Mutual labels:  airtable
orservices
ORServices is an open source, smartphone-friendly directory application that enables you to collect, verify, organize and share information about social services in your community with your stakeholders, beneficiaries, partner organizations and more.
Stars: ✭ 20 (-60%)
Mutual labels:  airtable
automatron
Personal LINE bot to automate various tasks. Home automation, expense tracking, transaction monitoring
Stars: ✭ 139 (+178%)
Mutual labels:  airtable
eleman
Fully dockerized static job board generator that uses Airtable as data source. Written with Python3.
Stars: ✭ 33 (-34%)
Mutual labels:  airtable
99StocksSwiftUI
SwiftUI app that fetches a list of companies, sort them by their share price and can show its details on a separate view
Stars: ✭ 34 (-32%)
Mutual labels:  sourcery
airtable-backups-boilerplate
Configurable automated backups for Airtable meant to be self-hosted, powered by AWS Lambda/S3 with the Serverless framework
Stars: ✭ 29 (-42%)
Mutual labels:  airtable

Update

For a more modern implementation, see AirtableKit

SwiftAirtable

Alt Text

Description

An unofficial Swift interface to Airtable's REST API

Usage

In order to make use of the Framework, simply create a strucuture

struct AirtablePerson {
    // The airtable object id
    var id: String = ""
    var name: String = ""
}

and make it adopt the AirtableObject protocol

extension AirtablePerson: AirtableObject {
    static var fieldKeys: [(fieldName: String, fieldType: AirtableTableSchemaFieldKey.KeyType)] {
        var fields = [(fieldName: String, fieldType: AirtableTableSchemaFieldKey.KeyType)]()
        fields.append((fieldName: AirtableField.name.rawValue, fieldType: .singleLineText))
        return fields
    }
    
    func value(forKey key: AirtableTableSchemaFieldKey) -> AirtableValue? {
        switch key {
        case AirtableTableSchemaFieldKey(fieldName: AirtableField.name.rawValue, fieldType: .singleLineText): return self.name
        default: return nil
        }
    }
    
    init(withId id: String, populatedTableSchemaKeys tableSchemaKeys: [AirtableTableSchemaFieldKey : AirtableValue]) {
        self.id = id
        tableSchemaKeys.forEach { element in
            switch element.key {
            case AirtableTableSchemaFieldKey(fieldName: AirtableField.name.rawValue, fieldType: .singleLineText): self.name = element.value.stringValue
            default: break
            }
        }
    }
}

Finally create an Airtable to perform the operations

let airtable = Airtable(apiKey: apiKey, apiBaseUrl: apiBaseUrl, schema: AirtablePerson.schema)

You can perform all standard CRUD operations

Create

airtable.createObject(with: object, inTable: table) { object: AirtablePerson, error: Error? in
    if let error = error {
        // Error Code
    } else {
        // Success Code
    }
}

Retrieve

airtable.fetchAll(table: table) { (objects: [AirtablePerson], error: Error?) in
    if let error = error {
        // Error Code
    } else {
        // Success Code
    }
}

Update

airtable.updateObject(with: object, inTable: table) { object: AirtablePerson?, error: Error? in
    if let error = error {
        // Error Code
    } else {
        // Success Code
    }
}

Delete

airtable.deleteObject(with: object, inTable: table) { sucess, error in
    if let error = error {
        // Error Code
    } else {
        // Success Code
    }
}

Example

To run the example project, clone the repo, and run pod install from the Example directory first. You'll need to provide your API Key and Base URL.

Installation

SwiftAirtable is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SwiftAirtable'

Author

Nicolas Nascimento, [email protected]

Sourcery

An stencil file is provided in the repo that allows you generate code for the AirtableObject protocol using Sourcery (https://github.com/krzysztofzablocki/Sourcery)

License

SwiftAirtable is available under the MIT license. See the LICENSE file for more info.

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].