exyte / Macaw

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

How to use Macaw library to display svg file from url ? #627

Closed aashish-nagar-spok closed 4 years ago

kushalhyperlink commented 5 years ago
    func loadNewSVG(fromURL url: URL) {
        let text = try String(contentsOf: url) // ... <svg width="34px" height="34px" viewBox="0 0 34 34" ....
        let node = try SVGParser.parse(text: text)
        svgView.node = node
    }
amarunko commented 5 years ago

Strongly not recommended using method String(contensOf:) especially on main thread, better - use URSSession approach or popular network services like Moya, Alamofire etc. Convert Data to string and parse