How do you handle an app that has some synced realms that do not require a login?

Hi all,

I have an app that needs to sync data from a collection without requiring a user to log in. I also have some collections that do require a log in and some collections that do not sync.

I understand that I need to have three separate realms, one configured to sync with a username, one to not sync and one to sync without a username.

Where I’m stuck is how to sync without requiring a user to log in. I know that I can use an anonymous user but I understand that this is just for development. This will also require me to log out any current users and switch the app’s current user to the anonymous user, which I do not want to do.

I read somewhere that I should generate a username quietly and just use that however, how would I handle this when the user does sign up to the app?