Skip to content

Sharing Node instance across different SVGViews causes infinite loop #488

@lubiluk

Description

@lubiluk

Hi, I use Macaw (great library) in such a way that I download SVG files from the internet to memory cache, turn them into Macaw Nodes, manipulate them to alter their colors and then use them as icons in a table view.

The issue

I noticed that when one Node instance appears in more than one SVGView the main thread enters an infinite loop (somewhere in drawRect).

Discussion

It looks like Macaw doesn't really like using Nodes directly. For instance, once a node is set on MacawView, there's no way to nil it out, so I had to use an awkward construction like this:

if let icon = model.icon {
    titleCell.iconSvgView.node = icon
} else {
    titleCell.iconSvgView.fileName = nil
}

I can of course try to redesign my code so it saves images on the disk but isn't it worth discussing why a flow that would be typical for UIImage does not work for Macaw.Node?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions