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

Documentation on how to setup the FlagValueSource as a shared UserDefaults from the "Settings" app #115

Open
will-lumley opened this issue Jul 18, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@will-lumley
Copy link
Contributor

will-lumley commented Jul 18, 2023

In the documentation it is stated that we recommend that the view/Vexillographer be contained in its own app.
This requires the user to setup an App Group, and then set the source in both the seperate app/target and in the app to be the shared UserDefaults file. While not super tricky to implement, I feel like it'd be nice to provide documentation on how to do that.

Happy to do it myself but wanted to flag (heh) the idea here first in case there's a reason why we shouldn't.

@will-lumley will-lumley added the enhancement New feature or request label Jul 18, 2023
@arinjoy
Copy link

arinjoy commented Aug 3, 2023

Hi @will-lumley - how are you mate? I am in a new app projec, where I am too keen to use Vexil with feature flags manager.

All docs working fine, understood the steps needed, and I managed to setup app-group to share UserDefaults between two app targets. But I ended up having the same issue that settings app does not let me change the flag values. And get stuck. You remembered how we managed that buggy issue in our plus app? Thanks mate, some tips (I just forgot how to) would really help me. 🙏🏽

cc- @bok-

Here is demo Gif below. It's all stuck . :( 😭
all-stuck

@arinjoy
Copy link

arinjoy commented Aug 3, 2023

As first step, I managed to include the Vexilographer based SwiftUI view in the main app hidden in secret corner of the app. All worked perfectly then.

But as next next step, I tried to take that part out in a dedicated FiddleSettings app target using the same app-group.

eg. I have used static let sharedUserDefaults = UserDefaults(suiteName: "group.arinappy.my-life") as UserDefaults creation and shared the same like this below here and with the SwiftUI view that uses Vexilographer init()


static let sharedUserDefaults = UserDefaults(suiteName: "group.arinappy.next-to-go")!

public let flags = FlagPole(
        hoist: AppFlags.self,
        sources: [
            Self.sharedUserDefaults,

            // TODO: Add other sources (like the real one mapping from Remote system
            // Refer to this documentation how to: https://vexil.unsignedapps.com/documentation/vexil/sources/
        ]
    )

But got into this stuck situation.

I did a a few troubleshooting like (my app's min deployment iOS is 15)

  • new simulators (old iOS and new iOS versions)
  • reset simulator
  • install main app first then install settings app next
  • install settings app first and then install main app next

@arinjoy
Copy link

arinjoy commented Aug 3, 2023

Actually, I have got it working now. 😀 Seems like I missed a step to attach the source precisely at one point.

Before: (not working :( )

private let flagPole = FlagPole(hoist: AppFlags.self)
...
Vexillographer(flagPole: flagPole, source: FlagService.sharedUserDefaults)

After: (working :) )

private let flagPole = FlagPole(hoist: AppFlags.self, sources: [FlagService.sharedUserDefaults])
...
Vexillographer(flagPole: flagPole, source: FlagService.sharedUserDefaults)

@will-lumley
Copy link
Contributor Author

@arinjoy Glad you got it working. I am working on my own app on the side and ran into this exact issue - hence why this issue which I raised that advocates for clearer documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants