Tutorial: From Sketch to Xcode — Using Capacitor.js

Juan Maguid
Mar 26 · 7 min read

Breaking news!

Thanks Richard 😺🧡

So, what’s Capacitor one may ask?

This is my workflow for this tutorial. You can of course also export this for Android but I’m not covering it.

Final build

Tutorial requirements

Install these first

xcode-select —install
sudo gem install cocoapods
Whatever gems are I’m up for it 💎😺

Get your Sketch2React HTML ready

Capacitor project requirements

1. How to create a package.json file from scratch

npm init

2. How to create a separate directory for web assets

3. Must have an index.html file

This is how your project folder should look like before installing Capacitor.js

Installing Capacitor

Step 1 — Installing the Capacitor client

This command installs Capacitor to your project folder — neat!
npm install @capacitor/core@next @capacitor/cli@next

Step 2 — Naming your app

This command prompts you to name your app and other important thingies
npx cap init
The built-in instructions are great, read them

Step 3 — Adding your web directory

Step 4 — Installing iOS project

npm install @capacitor/ios@next
npx cap add ios
No one is perfect

Step 5 — Opening up the iOS project in Xcode

Like eating magical beans
npx cap open ios
Aaah will you look at that

Step 6 — Fix those Xcode warnings

Step 7 — Run the app!

Updating your HTML

npx cap copy

Epilogue

Sketch2React

The best source of Sketch2React & Stratos Related articles…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store