Skip to main content

Command Palette

Search for a command to run...

iOS and Android Apps with Swift using Skip: Step-by-Step Guide

How to build iOS and Android apps with a single Swift codebase using Skip. A step-by-step guide with example source code.

Updated
2 min read
iOS and Android Apps with Swift using Skip: Step-by-Step Guide

Let's start with a dream of an iOS developer: a Swift codebase in Xcode that can run on both iOS and Android just like a native app! With Skip.tools, this dream is now a reality. Although still in its early stages, I hope more open-source solutions like this will make the dream come true!

💡
You can find an example implementation here: https://github.com/SajidHShanta/Skip-Swift-app-to-Android

Getting Started with Skip

1. Prerequisites

Ensure you have the following installed on your macOS system:

  • Xcode (for iOS development)

  • Android Studio (for Android emulator)

  • Homebrew (for package management)

If Homebrew is not installed, you can install it from here: https://docs.brew.sh/Installation

2. Install Skip

To install Skip, run the following command in your terminal:

brew install skiptools/skip/skip

Once installed, verify the setup with:

skip checkup

This command checks for missing dependencies and ensures everything is ready.

3. Create a Dual-Platform App

To initialize a new Skip project, use the following command:

skip init --appid=bundle.id project-name AppName
  • bundle id: Your app's unique identifier (e.g., com.example.myapp)

  • project-name: The folder where your project will be created.

  • AppName: The display name of your app.

Example Command:

skip init --open-xcode --appid=com.sajidhasan.testskip test-skip TestSkip

--open-xcode flag automatically opens the project in Xcode after initialization.

4. Preparing the Android Emulator

The skip init command generates a working template, but before building and running the app, you need to have an Android emulator up and running.

  1. Open Android Studio.app.

  2. Go to Virtual Device Manager (from the ellipsis menu on the Welcome screen).

  3. Click Create Device and follow the steps to set up a virtual Android device.

  4. Once created, Launch the emulator.

Ensure the emulator is running before building your app.

5. Explore and Build

Once your project is set up:

  1. Open the Xcode workspace if it is not already open.

  2. Write your Swift code as usual.

  3. Use Xcode to build and run the app on both iOS and Android simulators.

Final Thoughts

And that’s it. You are now equipped with Skip. Explore more functionalities from the Skip documentation and discover what you can achieve with this tool. Happy coding!

I would love to connect with you on LinkedIn. Here’s my profile: https://www.linkedin.com/in/sajidshanta/