Closed KlemenSpruk closed 3 years ago
This is the first I’ve seen of this. What parameters are you using?
Same crash. GHStyle
doesn't implement -(void) renderIntoContext:(CGContextRef)quartzContext withSVGContext:(id<SVGContext>)svgContext
Provided a fix. My apologies for taking so long.
Hello!
When calling function:
/// Returns an image from svg string /// /// - Parameters: /// - svgString: A svg string to parse /// - size: Maximum size of the image returned /// - shouldScale: When se to true the size will be scaled by the screen scale. Defaults to "true" /// - Returns: An image generated from the string static func image(withSVGString svgString: String, maximumSize size: CGSize, scaleForRetina shouldScale: Bool = true) -> UIImage? { return SVGRenderer(string: svgString).asImage(with: size, andScale: shouldScale ? UIScreen.main.scale : 1.0) } an exception with msg. bellow occurs.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GHStyle renderIntoContext:withSVGContext:]: unrecognized selector sent to instance 0x283899a00' terminating with uncaught exception of type NSException
Is it possible to somehow use do ( try ... ) catch {...} in swift to catch this exception or is there any other way to ignore error if image cannot be created?