GenerallyHelpfulSoftware / SVGgh

A framework for using SVG artwork in iOS Apps. Includes a UIView and a button class, printing and PDF export.
MIT License
141 stars 38 forks source link

Swift Package support #44

Open adamwulf opened 2 years ago

adamwulf commented 2 years ago

Thanks for SVGgh! We're migrating away from cocoapods and would love to be able to integrate this library with SPM. Any plans for adding a Package.swift sometime soon?

grhowes commented 2 years ago

I’ve been thinking about it. Doesn’t seem like it would be difficult.

ryanholden8 commented 2 years ago

I ended up doing this for a project in this commit: https://github.com/ryanholden8/SVGgh/commit/4d27b75caa24cf98a24243d1752665e43a97faad

grhowes commented 2 years ago

I ended up doing this for a project in this commit: ryanholden8@4d27b75

What is the reason for wrapping so much in

``#if __has_include(<UIKit/UIKit.h>)

I’ve spent the last day trying to get it packaged without too much disruption to the CocoaPod. Also trying to figure out how to make sure it bridges to Swiift automagically if possible.

ryanholden8 commented 2 years ago

@grhowes - Good question, and I wish I could remember the exact reason. This was for a swift project built out into modules via Swift packages where those packages had SVGgh as a dependency and it was built against iOS and Mac Catalyst. It may have been to work around an issue with SPM build process at the time or just me not targeting something correctly.

Maybe this: https://stackoverflow.com/a/34779231/2191796 or maybe the first issue here: https://stackoverflow.com/a/66238069/2191796

I have not revisited it recently but saw this post and wanted to show it's possible but it's not at the quality worthy of a PR so feel free to take the changes with a grain of salt ;)

Appreciate your work on this!