How to Build a SwiftUI App Powered by an Airtable Backend
Tags: Babies, Health, Business, Life, Coronavirus

How to Build a SwiftUI App Powered by an Airtable Backend

Screenshot by Zack Shapiro

Two weeks ago I published SwiftUIAirtableDemo, an open source repo on how to build an SwiftUI app that’s powered by an Airtable backend. Since then it’s done quite well, sitting at the top of Hacker News’s Show HN for more than a day and racking up 120 stars and 10 forks on GitHub!

From the repo:

This is a small, functional example app that demonstrates how you can use Airtable as a lightweight backend. I wouldn’t recommend using Airtable to store fast-moving data but as a means of storing strings, images, positions of views, and general data that won’t get updated very often, Airtable could be a potential option for you.

http://vidrio.org/wnc/videos-sevilla-v-real-valladolid-v-es-es-1rjx2-2.php

https://kleinoot.nl/vxr/Video-VVV-Venlo-Twente-v-en-gb-zav-.php

http://actiup.com/kck/videos-SC-Varzim-Feirense-v-en-gb-1lrq-8.php

http://vidrio.org/wnc/videos-sevilla-v-real-valladolid-v-es-es-1icz2-12.php

http://actiup.com/kck/video-SC-Varzim-Feirense-v-en-gb-1juc-16.php

https://kleinoot.nl/vxr/video-VVV-Venlo-Twente-v-en-gb-fge-.php

https://kleinoot.nl/vxr/v-ideos-VVV-Venlo-Twente-v-en-gb-ugx-.php

http://vidrio.org/wnc/video-sevilla-v-real-valladolid-v-es-es-1ibj2-17.php

http://actiup.com/kck/Video-SC-Varzim-Feirense-v-en-gb-1hlt-5.php

https://kleinoot.nl/vxr/video-Maccabi-Petach-Tikva-Maccabi-Haifa-v-en-gb-esb-.php

http://vidrio.org/wnc/video-sevilla-v-real-valladolid-v-es-es-1ouh2-10.php

https://kleinoot.nl/vxr/v-ideos-Maccabi-Petach-Tikva-Maccabi-Haifa-v-en-gb-idy-.php

https://kleinoot.nl/vxr/Video-Maccabi-Petach-Tikva-Maccabi-Haifa-v-en-gb-vkl-.php

http://vidrio.org/wnc/Video-sevilla-v-real-valladolid-v-es-es-1ysj2-12.php

http://vidrio.org/wnc/video-Sevilla-Real-Valladolid-v-en-gb-1bgs-12.php

http://actiup.com/kck/video-Lech-Poznan-Wisla-Krakow-v-en-gb-twc-.php

http://vidrio.org/wnc/videos-Sevilla-Real-Valladolid-v-en-gb-1eug-3.php

http://actiup.com/kck/v-ideos-Lech-Poznan-Wisla-Krakow-v-en-gb-avd-.php

http://actiup.com/kck/v-ideos-Lech-Poznan-Wisla-Krakow-v-en-gb-geh-.php

http://actiup.com/kck/videos-tondela-v-moreirense-v-yt2-1kps-8.php

http://vidrio.org/wnc/videos-Sevilla-Real-Valladolid-v-en-gb-1nln-7.php

https://kleinoot.nl/vxr/video-venetsiia-v-spal-v-yt2-1mzj-12.php

http://vidrio.org/wnc/v-ideos-Patronato-de-Parana-Aldosivi-v-en-gb-1izj-7.php

http://vidrio.org/wnc/video-Patronato-de-Parana-Aldosivi-v-en-gb-1olk-9.php

http://actiup.com/kck/videos-tondela-v-moreirense-v-yt2-1agr-13.php

https://kleinoot.nl/vxr/video-venetsiia-v-spal-v-yt2-1paf-16.php

http://actiup.com/kck/video-tondela-v-moreirense-v-yt2-1pcp-2.php

http://vidrio.org/wnc/v-ideos-Patronato-de-Parana-Aldosivi-v-en-gb-1dqd-13.php

https://kleinoot.nl/vxr/videos-venetsiia-v-spal-v-yt2-1rxp-11.php

http://vidrio.org/wnc/videos-Godoy-Cruz-Newell's-Old-Boys-v-en-gb-1myd-13.php

http://vidrio.org/wnc/Video-Godoy-Cruz-Newell's-Old-Boys-v-en-gb-1xkd-4.php

http://actiup.com/kck/v-ideos-tondela-v-moreirense-v-yt2-1nbs-1.php

https://kleinoot.nl/vxr/videos-venetsiia-v-spal-v-yt2-1mtb-7.php

http://vidrio.org/wnc/Video-Godoy-Cruz-Newell's-Old-Boys-v-en-gb-1qwa-15.php

https://kleinoot.nl/vxr/v-ideos-venetsiia-v-spal-v-yt2-1qyh-12.php

http://actiup.com/kck/videos-tondela-v-moreirense-v-yt2-1ohm-11.php

http://actiup.com/kck/v-ideos-RKC-Waalwijk-PSV-Eindhoven-v-en-gb-1tru-11.php

https://kleinoot.nl/vxr/Video-AA-Carapebus-RJ-Mesquita-RJ-v-en-gb-1ayi-.php

http://actiup.com/kck/videos-RKC-Waalwijk-PSV-Eindhoven-v-en-gb-1xpw-7.php

http://vidrio.org/wnc/videos-sarmiento-v-san-martin-de-tucuman-v-es-ar-1llz-2.php

http://vidrio.org/wnc/Video-sarmiento-v-san-martin-de-tucuman-v-es-ar-1jjp2-8.php

https://kleinoot.nl/vxr/v-ideos-AA-Carapebus-RJ-Mesquita-RJ-v-en-gb-1zpw-2.php

http://actiup.com/kck/video-RKC-Waalwijk-PSV-Eindhoven-v-en-gb-1hpx-1.php

http://actiup.com/kck/video-FC-Basel-St.-Gallen-1879-v-en-gb-1weo-1.php

https://kleinoot.nl/vxr/video-AA-Carapebus-RJ-Mesquita-RJ-v-en-gb-1onv-4.php

http://vidrio.org/wnc/Video-sarmiento-v-san-martin-de-tucuman-v-es-ar-1jrz2-1.php

http://actiup.com/kck/video-FC-Basel-St.-Gallen-1879-v-en-gb-1yqo-1.php

https://kleinoot.nl/vxr/v-ideos-Tondela-Moreirense-v-en-gb-1tbw-.php

http://actiup.com/kck/videos-FC-Basel-St.-Gallen-1879-v-en-gb-1nnb-2.php

https://kleinoot.nl/vxr/Video-Tondela-Moreirense-v-en-gb-1llj-17.php

http://vidrio.org/wnc/videos-sarmiento-v-san-martin-de-tucuman-v-es-ar-1urc-3.php

http://vidrio.org/wnc/video-sarmiento-v-san-martin-de-tucuman-v-es-ar-1nkc2-2.php

https://kleinoot.nl/vxr/videos-Tondela-Moreirense-v-en-gb-1xex-6.php

http://vidrio.org/wnc/Video-Chacarita-Juniors-Gimnasia-Jujuy-v-en-gb-1bpn-2.php

http://vidrio.org/wnc/videos-Chacarita-Juniors-Gimnasia-Jujuy-v-en-gb-1gxr-17.php

http://vidrio.org/wnc/Video-Chacarita-Juniors-Gimnasia-Jujuy-v-en-gb-1piu-4.php

http://actiup.com/kck/video-nautico-v-sampaio-correa-v-pt-br-1xvf-4.php

http://actiup.com/kck/Video-nautico-v-sampaio-correa-v-pt-br-1nsf2-18.php

http://vidrio.org/wnc/videos-chacarita-juniors-v-gimnasia-y-esgrima-v-es-ar-1icc-16.php

http://vidrio.org/wnc/video-chacarita-juniors-v-gimnasia-y-esgrima-v-es-ar-1mwe2-13.php

http://actiup.com/kck/videos-nautico-v-sampaio-correa-v-pt-br-1osm2-14.php

http://actiup.com/kck/Video-nautico-v-sampaio-correa-v-pt-br-1vgn-10.php

http://vidrio.org/wnc/Video-chacarita-juniors-v-gimnasia-y-esgrima-v-es-ar-1ztx2-8.php

http://vidrio.org/wnc/video-chacarita-juniors-v-gimnasia-y-esgrima-v-es-ar-1iwj2-6.php

http://actiup.com/kck/videos-nautico-v-sampaio-correa-v-pt-br-1bje-9.php

http://vidrio.org/wnc/Video-chacarita-juniors-v-gimnasia-y-esgrima-v-es-ar-1bce2-11.php

https://kleinoot.nl/vxr/Video-olympique-marseille-v-stade-de-reims-v-fr-fr-1jzo-3.php

http://vidrio.org/wnc/v-ideos-Brown-de-Adrogue-Almagro-v-en-gb-1ljs-11.php

http://actiup.com/kck/videos-parma-v-juventus-v-it-it-1riq2-4.php

http://actiup.com/kck/videos-parma-v-juventus-v-it-it-1vbl-17.php

http://vidrio.org/wnc/v-ideos-Brown-de-Adrogue-Almagro-v-en-gb-1hax-13.php

https://kleinoot.nl/vxr/videos-olympique-marseille-v-stade-de-reims-v-fr-fr-1hnz-17.php

http://vidrio.org/wnc/videos-Brown-de-Adrogue-Almagro-v-en-gb-1tfj-13.php

https://kleinoot.nl/vxr/videos-olympique-marseille-v-stade-de-reims-v-fr-fr-1ezl-3.php

http://actiup.com/kck/Video-parma-v-juventus-v-it-it-1aoo2-6.php

http://actiup.com/kck/video-parma-v-juventus-v-it-it-1egw-5.php

http://vidrio.org/wnc/video-atletico-brown-v-almagro-v-es-ar-1yku2-3.php

https://kleinoot.nl/vxr/videos-olympique-marseille-v-stade-de-reims-v-fr-fr-1muk-3.php

http://vidrio.org/wnc/videos-atletico-brown-v-almagro-v-es-ar-1tuk2-8.php

http://actiup.com/kck/videos-parma-v-juventus-v-it-it-1ipv2-5.php

https://kleinoot.nl/vxr/v-ideos-olympique-marseille-v-stade-de-reims-v-fr-fr-1ruw-5.php

http://actiup.com/kck/videos-Parma-Juventus-v-en-gb-1cuw-5.php

https://kleinoot.nl/vxr/videos-Olympique-Marseille-Stade-de-Reims-v-en-gb-1coo-.php

http://vidrio.org/wnc/Video-atletico-brown-v-almagro-v-es-ar-1kyt-4.php

http://actiup.com/kck/Video-Parma-Juventus-v-en-gb-1ynf-13.php

https://kleinoot.nl/vxr/v-ideos-Olympique-Marseille-Stade-de-Reims-v-en-gb-1qqy-17.php

http://vidrio.org/wnc/v-ideos-atletico-brown-v-almagro-v-es-ar-1bgr-18.php

http://actiup.com/kck/Video-Parma-Juventus-v-en-gb-1qbg-6.php

https://kleinoot.nl/vxr/video-Olympique-Marseille-Stade-de-Reims-v-en-gb-1dpg-14.php

http://actiup.com/kck/Video-Genk-KV-Kortrijk-v-en-gb-1exi-6.php

http://vidrio.org/wnc/video-atletico-brown-v-almagro-v-es-ar-1ctp-17.php

http://vidrio.org/wnc/v-ideos-All-Boys-Quilmes-v-en-gb-1qcq-17.php

http://actiup.com/kck/v-ideos-Genk-KV-Kortrijk-v-en-gb-1isz-10.php

https://kleinoot.nl/vxr/v-ideos-carapebus-v-mesquita-rj-v-pt-br-1wwi-12.php

http://vidrio.org/wnc/videos-All-Boys-Quilmes-v-en-gb-1dob-3.php

http://actiup.com/kck/videos-Genk-KV-Kortrijk-v-en-gb-1dsm-6.php

http://vidrio.org/wnc/v-ideos-All-Boys-Quilmes-v-en-gb-1usu-8.php

https://kleinoot.nl/vxr/videos-carapebus-v-mesquita-rj-v-pt-br-1wgp-10.php

https://kleinoot.nl/vxr/videos-carapebus-v-mesquita-rj-v-pt-br-1ldh2-4.php

http://vidrio.org/wnc/video-all-boys-v-quilmes-v-es-ar-1yxl2-3.php

And uses the data to render these views:

Pretty cool right?

In the content tab, the view column tells the app which Component to render, where a UIComponent is outlined by a simple protocol:

protocol UIComponent {

var uniqueId: String { get }

func render() -> AnyView

}

The position and title columns determine what data goes into the component. For the purposes of the demo, the Components aren’t very complex.

In our DetailView, we have a segmented control that allows the user to toggle between fruits and vegetables and delete them if they choose to deleting does not update the Airtable). All of the data for that view, from the data in the segmented control to the data that populates the List is provided from the Airtable.

By implementing a timer on the HomeView:

private let timer = Timer.publish(every: 5, on: .main, in: .common).autoconnect()

and listening for it:

.onReceive(timer) { _ in

self.refreshContent()

}

The view will redraw itself every five seconds if anything in the Airtable’s content tab has changed.

Pretty cool right?

Server-driven UI has been done for quite a while now but with the ease and flexibility that both SwiftUI and Airtable provide, I thought it would be fun to put together a little example project so that you can learn the ropes and get started with building your own apps!

Come to my session at try! Swift World on 5/28 from 3–5p EDT

On 5/28/20 from 3–5p EDT

Next week I’m teaching a session on this at NatashaTheRobot’s try! Swift World on 5/28 from 3–5p EDT.

Tickets are $50 and spots are limited to 10. Come join me as I talk about building dynamic apps with SwiftUI and Airtable! I hope to see you there!

Buy your ticket here!