svgmenupaintcode

Using PathMenu with SVG in a Paintcode StyleKit


I need to change the image programmatically that PathMenu uses to design. I have a PaintCode generated StyleKit which draws .SVG files, not an image in a Asset.xcassets.

PathMenu uses something like this to take the images:

    let menuItemImage = UIImage(named: "bg-menuitem")!

but I need to make something like

     let menuItemImage = myImageFromMyStyleKit

How can I make this work?


Solution

  • In PaintCode document, select canvas and in Inspector, select StyleKit Image Method from dropdown menu in Code Export section.

    Canvas Code Export

    This canvas will then generate imageOfCanvas... method, instead of drawCanvas... method. This way, you can then simply obtain image of this canvas and use it in the menu item.

    PathMenuItem(image: StyleKit.imageOfCanvas)