Daniel
12/20/2024, 11:11 PMclass SingletonRepo{
  static var shared = FirestoreRepo()
   
  private init() { }
   
  static func reset() {
    //shared.closeRealm()
    shared = FirestoreRepo()
  }
The way that I use my repo in my Swift code:
var repo = SingletonRepo.shared
repo.myMethod()
My question is should I make the singleton class as @MainActor?
While swiftching to Swift version 6 I get an error: Static property 'shared' is not concurrency-safe because it is nonisolated global shared mutable state
Should I change to MainActor or Sendable?Ioana Stoicescu
03/17/2025, 6:10 PM