Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use svgAttributes when generating SVGRepresentation for SVGBezierPath #113

Merged
merged 2 commits into from Mar 6, 2018

Conversation

mciuba
Copy link
Contributor

@mciuba mciuba commented Mar 1, 2018

Fixes #112

@arielelkin arielelkin requested a review from fjolnir March 1, 2018 14:55
SVGBezierPath.mm Outdated
return SVGStringFromCGPaths(@[(__bridge id)self.CGPath], nil);
SVGMutableAttributeSet *attributes = [SVGMutableAttributeSet new];
[attributes setAttributes:self.svgAttributes forPath:self.CGPath];
return SVGStringFromCGPaths(@[(__bridge id)self.CGPath], [attributes copy]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't return SVGStringFromCGPaths(@[(__bridge id)self.CGPath], self.attributes) work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, it wouldn't work because self.attributes is a NSDictionary<NSString*, id> and SVGStringFromCGPaths expects SVGAttributeSet as the second parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. Sorry. It's been a little while since I worked on this :)
Then apart from the copy being unnecessary, it looks good!

Copy link
Member

@fjolnir fjolnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the copy when passing the attributes to SVGStringFromCGPaths. And thanks for contributing!

@mciuba
Copy link
Contributor Author

mciuba commented Mar 5, 2018

@fjolnir Fixed. Good point, defensive copy is not needed in this case. It's been a little while since I worked on Objective-C ;)

@fjolnir fjolnir merged commit 332f879 into pocketsvg:master Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants