Skip to content

migueldeicaza/SkiaKit

Repository files navigation

SkiaKit

Go to macOS / iOS / tvOS | Go to Linux

SkiaKit is a 2D Graphics Library for use with Swift. It is powered by Google's Skia graphics library, the same library that powers Google Chrome and Android graphics.

You can review the API Documentation

The Swift bindings are intended to be cross-platform, both to Apple platforms, Linux, and new platforms where Skia and Swift run.

This work uses extensive code from Microsoft's SkiaSharp bindings authored by Matthew Leibowitz and dozens of contributors. SkiaSharp just happens to have a very advanced set of bridge APIs to the underlying Skia engine that does not existing in the upstream Google Skia project.

Getting this to work

Apple

Supports:

  • x86_64 Mac: anything from 2008 MacBook to M1 (using x86 emulation)
  • arm64 iPhone: anything past iPhone 5S
  • arm64 iPad: anything past iPad Air / iPad mini 2 (post-2013)
  • iPhone Simulator
  • iPad Simulator
  • tvOS

Not currently supported:

  • Mac Catalyst

Recommended usage

You can add SkiaKit to your project by putting this dependency in your Package.swift:

.package(url: "https://github.com/migueldeicaza/SkiaKit.git", from: "1.0.0")

Using manually

If using manually, you'll need to download and assemble the SkiaSharp.xcframework required.

This must be ran on macOS with the Command Line Tools for XCode installed.

git clone https://github.com/migueldeicaza/SkiaKit.git
cd SkiaKit
make download-payload

Linux

SkiaKit is platform agnostic and makes a best-effort support for Linux. An .so for the SkiaSharp library is included and supports the following Linux distributions.

The libSkiaSharp.so file will need to be distributed alongside your project.

Recommended usage

You can add SkiaKit to your project by putting this dependency in your Package.swift:

.package(url: "https://github.com/migueldeicaza/SkiaKit.git", .branch("generated"))

Using manually

If using manually, you'll need to provide libSkiaSharp.so in the root of the SkiaKit folder. For certain Linux distros, a convenience script is provided.

This script requires curl and unzip.

git clone https://github.com/migueldeicaza/SkiaKit.git
cd SkiaKit
make download-payload-linux