GithubHelp home page GithubHelp logo

figmasharp's Introduction

FigmaSharp – Create apps with Figma

Here at Microsoft we ❤️ Figma. We use it for everything and anything. So much so, we thought why not use it to actually implement our user interfaces? Sounds crazy enough to work. Let's give this a go.

A macOS app window created with FigmaSharp

FigmaSharp turns your Figma design into .NET objects and can generate code and layout files to create native apps. Free and Open Source software under the MIT LICENSE.

Build Status

Getting started

We recommend reading through the Wiki to get a sense of the FigmaSharp workflow.

To get documents from figma.com you'll need to generate a Personal Access Token. Sign in to Figma and in the main menu, go to Help and Account → Account Settings and select Create new token. This will be your only chance to copy the token, so make sure you keep a copy in a secure place.

Try out automatic builds of the FigmaSharp app and Visual Studio extension from the Releases page.

Do you have questions, need support, or want to contribute? Join the chat on Discord.

Visual Studio extension

The Visual Studio for Mac extension contains the tools to preview Figma documents and generate Packages ready to use in your projects. Download the .mpack from the Releases page.

FigmaSharp app and Visual Studio extension

The Visual Studio for Mac extension contains the tools to preview Figma documents and generate Packages ready to use in your projects. Download the .mpack from the Releases page. Install it via Visual Studio → Extensions → Install from file….

The FigmaSharp app previews Figma documents without having to install Visual Studio. Download the .app from the Releases page.


Building from source

Make sure to have the latest version of Xcode. Also install Xamarin.Mac, you can get it via the Visual Studio for Mac Installer.

Open FigmaSharp.Mac.sln in Visual Studio for Mac. For each project in the Tools or Samples folder you want to run, open the project's Project Options, go to Run → Configurations → Default and add an environment variable called TOKEN, then paste in the Personal Access Token for your Figma account.

Visual Studio for Mac extension

Select MonoDevelop.Figma in the target selector in the toolbar and run it. This will start a new Visual Studio for Mac instance with the extension enabled. Alternatively, you can run make in the FigmaSharp source folder. This will generate a .mpack file that can be installed on other computers.

FigmaSharpApp

Select FigmaSharpApp in the target selector in the toolbar and run it.


Keep calm and hack the planet.

figmasharp's People

Contributors

blacroixsp avatar dependabot[bot] avatar hbons avatar jsuarezruiz avatar kblok avatar mrward avatar netonjm avatar nmilcoff avatar therzok avatar youssef1313 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

figmasharp's Issues

Extension UX improvements

  • Nest .designer.cs file inside base class file
  • Implement updated dialog design
  • Hook up Namespace field
  • Hide window and show progress in Visual Studio status bar. "Bundling $ID…"

later:

  • Fix beachballing (UI freezes, see #125)

Bundler tool

The bundler tool is a simple dialog that adds a Figma document to your project.

Mockup:
image

New bundling model

  • Remove ".FigmaPackages" and use default namespace

@netonjm

  • Find the correct namespace to use automatically
  • Figma documents should become References, create a toplevel "Figma" folder in project

image

  • Figma reference context menu:

image

  • Create "Bundle Figma Document Here" command to allow generating code at any location in the project:

  • Keep track of generated code's "parent" Figma document through csproj metadata

  • Menu structure:

image

@hbons Update the bundler tool design

  • Design new UI for bundler tool
  • Design update mode:

image

  • "Namespace:" field to set manually, also set it in the manifest
  • Add way to select a Figma reference to generate from

Metadata in generated comments

The generated code-behind file comment should show useful info about which Figma .json file was used for debugging and legal purposes:

  • Document URL
  • Document version
  • Date and time
  • Figma API version
  • FigmaSharp version

Question: where does this fit in?

I'm having a bit of trouble understanding what the use case for this library is, so apologies in advance for the basic question. I do not currently use Figma but was looking at it as a potential option for mocking up some views before development.... so my question is how would this library fit into the overall workflow of going from design to development? (just at a high level)

Demo time checklist

Spec:

image

  • Fix button text size
  • Fix checkbox text size
  • Use single line mode on textfield
  • Fix radio button cut off geometry
  • Don't use custom fonts anywhere

Extension:

  • Fix content not being added to window and fix junk classes being generated: https://www.figma.com/file/zV2VF7tEdzCJL2CRo6pprz/Breakpoints?node-id=0%3A1
  • Use Document Title in solution nodes instead of the ID
  • Document Title in manifest.json and use for autogeneration comment
  • Use document version in autogeneration comment (or date if no label)
  • Use namespace of the current app. (or at least use "Figma" instead of "FigmaSharp" to avoid conflicts)
  • Only create classes for groups of type FRAME at the top level of the document
  • Remove layers starting with "# " or "// " from the .json

Sample app:

  • Fix beachballing (UI freezes)
  • Fix "double" drawing of images on top of native controls

Svg to native views feature

Right now, we use the figma api to get all the custom shapes converted into png images. Although this approach the result is not accurate as we want. To fix this we should create our own library to parse this shapes into a real native views in each platform.

We can use maybe? : https://www.nuget.org/packages/NGraphics/

FigmaSharpApp UX improvements

The FigmaSharpApp takes a Figma document URL and previews how it would be rendered using FigmaSharp.

To do:

  • Page switcher
  • Native controls preview
  • Center Open dialog
  • Larger preview window
  • Center document in window (maybe add large minimum padding?)
  • Show version history (depends on #49)
  • Fix progress indicators
  • Fix new window position
  • Fix version/page switcher

Figma to Code

Create some converters or think how we can generate code from our models to copy/paste

Investigate how to handle templated lists

Currently, some figma designs have hard coded list items.

What is the process to template-ize the list so it doesn't render the content, but allows for MVVM/MVC integration?

0.1 scenario

Designer

  1. Designer creates a single Cocoa window with controls using the "macOS Components" library
  2. Designer downloads the FigmaSharp app
  3. Designer copies the Figma document URL and opens it with the FigmaSharp app
  4. The app shows the design rendered with Cocoa, the designer checks for mistakes and reloads the document when changes are made

Developer

  1. Developer receives a Figma document URL
  2. Developer installs the FigmaSharp VSmac extension
  3. Developer right-clicks the project they want to add the UI to and selects "Add -> Figma Document".
  4. Developer selects "Cocoa" and "None" and clicks "Add"
  5. The developer hooks up the UI with the exposed members as if it was a .xib file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.