SvelteKit Capacitor starter
Presentation
See this presentation that was given on This Week in Svelte:
![](https://private-user-images.githubusercontent.com/1207507/268011467-a465f6f8-e0f2-4074-a2ec-6f820f592b54.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQ0NDA0MDksIm5iZiI6MTcwNDQ0MDEwOSwicGF0aCI6Ii8xMjA3NTA3LzI2ODAxMTQ2Ny1hNDY1ZjZmOC1lMGYyLTQwNzQtYTJlYy02ZjgyMGY1OTJiNTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDEwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAxMDVUMDczNTA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZTEyYTQ1ZDQ0YWY4Y2YzYmVmNjdjM2ZhZWJkMWYzNmExZjg0OTM2NjRkZTgyZGYzZTJiNTNkM2YxYmU3MzJhYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.hCNk3UHib9gDA47noa7U51bA86ryeMUBdmk_crLlxEQ)
This is a simple demo project of SvelteKit + Capacitor. It is not a complete starter but more of an example of a Capacitor setup.
To add all the functionality, copy the contents of demo/complete/+page.svelte
to src/routes/+page.svelte
.
This demo only has iOS added to the project. Android can optionally be added via the instructions in the Capacitor documentation.
Basic steps:
- Follow the setup guide for setting up your environment under iOS
- Edit
capacitor.config.ts
, underserver.url
, add your local IP address. - Perform the commands below
nvm use
npm i
npm run dev
- Start XCode and open the
/ios
folder in it via the "Open a project or file" button of the start screen. - Start the app either on a physical device or on an emulator via the Run ("Play") button
Automating building of iOS/Android bundles via GitHub Actions
See these blog posts:
- Build your Capacitor iOS app bundle using GitHub Actions
- Build your Capacitor Android app bundle using GitHub Actions