uber / cyborg

Display Android Vectordrawables on iOS.
Apache License 2.0
300 stars 19 forks source link

MacOS and tvOS support #80

Closed ashare80 closed 3 years ago

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

benpious commented 3 years ago

I tested this, and found two issues:

  1. the mac version doesn't support setting the drawable after it's been laid out. The fix seems to be needsLayout = true in drawableLayers or drawable
  2. It seems that MacOS is far less liberal than iOS about calling getRed:blue:green:alpha: on colors which use different color spaces, and will throw an exception if this is called on a color that isn't in sRGB.

I'm okay landing with these still in, I can clean them up later. Just a heads up in case you're using this code.

ashare80 commented 3 years ago

I tested this, and found two issues:

  1. the mac version doesn't support setting the drawable after it's been laid out. The fix seems to be needsLayout = true in drawableLayers or drawable
  2. It seems that MacOS is far less liberal than iOS about calling getRed:blue:green:alpha: on colors which use different color spaces, and will throw an exception if this is called on a color that isn't in sRGB.

I'm okay landing with these still in, I can clean them up later. Just a heads up in case you're using this code.

Cool yeah I didn't really test yet, main goal was just trying to get it to at least import nicely with a macOS/iOS SwiftUI app. I guess technically with the NSView being used the min macOS version could be lower, just not sure how low.