DevSpotlight: A Multiplatform SwiftUI App
DevSpotlight – A Multiplatform SwiftUI App
DevSpotlight is a multiplatform app that provides the latest tech news. It is built using SwiftUI and targets both macOS and iOS platforms. The app uses Supabase as its database to store and retrieve tech news articles. In order to set up the app, you will need to create a Secrets.swift
file to securely store your Supabase host and API key.
Prerequisites
Before you can use DevSpotlight, make sure you have the following prerequisites in place:
-
Supabase Account: You should have a Supabase account and a project set up.
-
Database Tables: You need to create the following tables in your Supabase project and populate them with data:
SidebarOptions
: This table stores options for the app’s sidebar menu.SidebarSections
: This table stores sections for the sidebar.Spotlights
: This table stores tech news articles.
Please refer to the provided database schema below for table structure details.
-
Supabase API Key: You should generate an API key from your Supabase project settings. This API key will be used to access your Supabase project from the app.
Setting up Secrets.swift
In order to keep your Supabase credentials secure, you need to create a Secrets.swift
file in your Xcode project. This file should contain the following structure:
struct Secrets {
static let supabaseHost = "YOUR_SUPABASE_HOST"
static let supabaseAPIKey = "YOUR_SUPABASE_API_KEY"
}
Replace "YOUR_SUPABASE_HOST"
and "YOUR_SUPABASE_API_KEY"
with your Supabase project’s host URL and API key.
Note: Make sure to add Secrets.swift
to your .gitignore
file to prevent your sensitive information from being pushed to version control.
Database Schema
Here is the schema for the tables you need to create in your Supabase project:
SidebarOptions Table
sqlCopy code
create table
public."SidebarOptions" (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
icon character varying not null,
name character varying not null,
section_id uuid null,
tag text null,
constraint SidebarOptions_pkey primary key (id),
constraint SidebarOptions_section_id_fkey foreign key (section_id) references "SidebarSections" (id),
constraint SidebarOptions_tag_fkey foreign key (tag) references "Tags" (tag)
) tablespace pg_default;
SidebarSections Table
sqlCopy code
create table
public."SidebarSections" (
id uuid not null default gen_random_uuid (),
created_at timestamp with time zone not null default now(),
name character varying not null,
constraint Sidebar.Sections_pkey primary key (id)
) tablespace pg_default;
Spotlights Table
sqlCopy code
create table
public."Spotlights" (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
by character varying not null,
title text not null,
"imageURL" text not null,
"articleURL" text not null,
tags text[] not null,
constraint News_pkey primary key (id)
) tablespace pg_default;
Running the App
Once you have set up your Secrets.swift
file and created the required database tables, you can run the DevSpotlight app on both macOS and iOS platforms using Xcode.
Contributing
If you’d like to contribute to DevSpotlight, feel free to fork the repository, make improvements, and submit a pull request. We welcome contributions from the community!
License
MIT License
Copyright (c) 2023 Amit Samant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Happy coding with DevSpotlight! If you have any questions or need further assistance, please don’t hesitate to reach out.