Код: Выделить всё
Non-sendable type 'Realm' returned by implicitly asynchronous call to nonisolated
function cannot cross actor boundary; this is an error in the Swift 6 language mode
Код: Выделить всё
@preconcurrency import RealmSwift
import Foundation
public protocol StorageProtocol: Actor {
@StorageActor var realm: Realm? { get }
}
public actor Storage: StorageProtocol {
@StorageActor public var realm: Realm?
@StorageActor
public init(_ name: String) async throws {
var config = Realm.Configuration.defaultConfiguration
guard var fileURL = config.fileURL else { throw StorageError.initialize }
fileURL.deleteLastPathComponent()
fileURL.appendPathComponent(name)
fileURL.appendPathExtension("realm")
config.fileURL = fileURL
print(config.fileURL?.absoluteString ?? "")
realm = try await Realm(configuration: config, actor: StorageActor.shared)
}
}
@globalActor public actor StorageActor: GlobalActor {
static public var shared = StorageActor()
}

Есть идеи, как можно решить проблему это?
Подробнее здесь: https://stackoverflow.com/questions/793 ... le-warning