CodingMeSwiftly / UIBezierPath-Superpowers

MIT License
78 stars 16 forks source link

[Feature] Cocoa support #9

Open stripes opened 6 years ago

stripes commented 6 years ago

Thanks for writing this! I want almost this exact thing, except for NSBezierPath (I'm not writing a iOS app, I'm driving a laser cutter from my Mac).

I'm going to give writing the NSBezierPath version a shot.

stripes commented 6 years ago

& I have one that works for NSBezierPath, except all the swizzling stuff is not yet hooked up to note each mutation (I happen to currently be using it AFTER I am done mutating the paths)

CodingMeSwiftly commented 6 years ago

Hi there. Sorry for the delayed response. Driving a laser cutter using this library sound so dope! Thanks for that :). It should be fairly ease to implement support for NSBezierPath, actually. Both UIBezierPath and NSBezierPath are merely wrappers for CGPath, so we should be able to introduce some #if to check if we're on macOS or iOS and keep the API as is. I'll have a look into that today. If you already have worked out something, feel free to submit a PR, I'll happily accept it. :)

CodingMeSwiftly commented 6 years ago

Update: NSBezierPath has quite a different interface than UIBezierPath and you apparently cannot access the underlying CGPath - bummer. Supporting both Cocoa and CocoaTouch requires some changes to the overall structure of the project. I'm willing to undertake this, however it might take some days for me to finish. I'll try to publish the new version by the end of the week. (Including both CocoaPods and Carthage support - Yay).

stripes commented 6 years ago

I have one working, except the method swizzle for detecting changes is incomplete (I use NSBezierPaths in a mostly immutable way).

I just made a copy of the file & changed what was needed. I’m sure with a little effort most of the code could be shared between UI and NS versions.

--

On Feb 1, 2018, at 03:24, Max Kraus notifications@github.com wrote:

Update: NSBezierPath has quite a different interface than UIBezierPath and you apparently cannot access the underlying CGPath - bummer. Supporting both Cocoa and CocoaTouch requires some changes to the overall structure of the project. I'm willing to undertake this, however it might take some days for me to finish. I'll try to publish the new version by the end of the week. (Including both CocoaPods and Carthage support - Yay).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

stripes commented 6 years ago

I've never actually made a pull request before, so hopefully I did it right. I sent you the NSBezierPath version I have. Let me know if it didn't make it.