Back to Plugins
Swift Package Exporter

Swift Package Exporter

Generate SwiftUI from your design tokens.

design tokensno codeiosexporterswiftuixcodehandoffdesign systemswiftpackagecode-generators

Plugin Preview

Swift Package Exporter preview

About this plugin

Generate SwiftUI from your design tokens and export as package. Once included in Xcode, developers will have access to design tokens directly through Xcode's editor and code complete.


To get started install the plugin and run it on this sample file.



Learn more: https://figmatoswift.com


👉 Supported Styles

Styles defined in your document will be automatically recognized by the plugin including:


  • ✅ Text
  • ✅ Solid Colors
  • ✅ Linear Gradients
  • ✅ Angular Gradients
  • ✅ Drop Shadows
  • ✅ Layer Blurs
  • ✅ Grid styles


* Radial and diamond gradients are not currently supported.

* Inner shadow and background blur are not currently supported.


👉 Images

Requirements for adding images to Swift package:

  • Only vector images are supported
  • Images must be defined as components
  • Images must be wrapped in a frame named Images.swift


👉 Adding the Package to Xcode

  1. Unzip the exported file and drag the entire DesignSystem folder into the Xcode project navigator right below the project name.
  2. Add the DesignSystem package to Frameworks, Libraries and Embedded Content inside your projects general settings.
  3. Import the DesignSystem module in any views that you want to use design tokens with import DesignSystem


👉 Example Usage

  • .font(Font.DesignSystem.headline1)
  • .foregroundColor(Color.DesignSystem.primary)
  • .modifier(Effect.DesignSystem.Elevation1())
  • .padding(Spacing.DesignSystem.xSmall4)
  • Image.DesignSystem.welcome


👉 FAQs & Known Issues

  • Style names that contain numbers can sometimes cause issues in Xcode. For ex "blue/1" and "blue/-1" will cause an error)
  • Apple docs on adding custom fonts to Xcode
  • The Mac App Store version of Xcode has a bug that prevents packages from working. Download Xcode directly from Apple's Developer site to resolve. Apple Developer Site


Feedback and Support

Plugin Details

Version3
CreatedNovember 12, 2021
Last UpdatedJune 5, 2023
CategorySoftware development
CreatorTodd Hamilton
Stats1210 installs, 83 likes
PricingFree

Technical Details

  • API:1.0.0
  • UI:dist/ui.html
  • main:dist/code.js
  • Editor Types:
    figma