I’m facing an issue while trying to modify a static property within a subclass of UIViewController from another class, specifically inside an asynchronous function. Additionally, I’m encountering the error “Main actor-isolated static property 'text' cannot be mutated from a non-isolated context; this is an error in Swift 6
“
class Primary:UIViewController{
static var text = ""
}
class Secondary{
func someAction() async{
Primary.text = "12"//Getting warning in this line
}
}
anyhow by using DispatchQueue.main.async
will silence this warning. My question is that why static property in UIViewcontroller is considerred as actor’s (isolated) property? If it is isolated, then why can’t we use await(just curious) to access that property?