Usage of var repo=RealmRepo() affecting performance?

I ve been watching Realm for KMM. For this sample:

I can see that for the iOS code, you use var repo=RealmRepo() in every view, wouldn’t this affect the performance if we would have multiple views?

What is the best approach in this case? Singleton class?

Thank you in advance!

@Mohit_Sharma

Hello @Daniel_Gabor :

Thanks for reaching out. Yes, creating Realm per view is overhead, thanks for pointing that out, didn’t consider while creating a simple app.

You can use any DI framework ( or vanilla factory) with gives you Singleton instance of Realm.