EvanBacon / expo-apple-targets

Config Plugin to setup Apple targets
305 stars 29 forks source link

$accent and $widgetBackground are not working #30

Open buraks opened 5 months ago

buraks commented 5 months ago
image

It seems like $accent and $widgetBackground are not working. Neither does for Pillar Valley from the looks of it.

IMG_F9E31A66CC84-1

I tried to fix the problem, but failed so far. @EvanBacon if you can point me in a direction I can try to provide a PR.

PS: Thank you so much for your work on this repo and open sourcing Pillar Valley. These have been super useful!

bpingris commented 3 months ago

hello! how are you setting up your colors? in my expo-target.config.js I have:

/** @type {import('@bacons/apple-targets').Config} */
module.exports = {
    type: 'widget',
    name: 'Foobar',
    colors: {
        $primary: '#FF4239',
    },
    frameworks: ['SwiftUI'],
    entitlements: {
        'com.apple.security.application-groups': ['group.foo-bar.data'],
    },
    deploymentTarget: '15.0',
}

then I am able to use that color in my swift code with Color("$primary"), like:

            Text("Foo bar")
                .foregroundColor(Color("$primary"))

I have to run the expo prebuild -p ios command when updating the colors from my expo-target.config file

and my widget is using the colors I am setting, however I didn't try the light/dark theme property, maybe the issue you have is related to this?

buraks commented 3 months ago

The issue I am mentioning is not about how to use colors on Swift, that part works for me as well.

However, $accent and $widgetBackground are supposed to be special ones that end up setting some config on the XCode project

https://github.com/EvanBacon/expo-apple-targets/blob/main/packages/apple-targets/README.md?plain=1#L95

However, they don't seem to be working.