exyte / Macaw

Powerful and easy-to-use vector graphics Swift library with SVG support
MIT License
6k stars 552 forks source link

Is it only by "id" #766

Open allensoberano opened 2 years ago

allensoberano commented 2 years ago

When referencing the element, I've only been able to do it by "id". Are you not able to reference the node by "class" as well? Whenever I try to reference by "class", the following code errors let nodeShape = self.node.nodeBy(tag: nodeTag) as! Shape because` it's always nil, but if an "id" is added to the class then it works just fine by id reference.

The problem is the SVG I will be receiving will not have "ids" for specific objects I need to color in the SVG.

Examples: This works fine because it has an 'id' <circle id="circle1" cx="145.461" cy="308.524" r="18.8" transform="rotate(180,145.461,308.524)" /> but something like this is always returning nil: <path class="sectionA" style="fill:#ffffff;stroke:#e5e5e5" d="M 53.695242,337.52531 L 176.63156,337.52531 L 176.63156,83.836587 L 53.695242,83.836587 L 53.695242,337.52531 z" />