Avatar ·

Erro «This application is modifying the autolayout engine from a background thread» — como corrigir?

Olá a todos! Sou novo em Swift e desenvolvimento para macOS. Me deparei com um erro estranho que não aparece sempre, mas apenas quando o aplicativo executa alguma operação longa. No console, é exibida a mensagem: ``` This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes. ``` Tenho um exemplo simples: estou carregando dados da internet em uma background thread e, após a conclusão, quero atualizar um `NSTextField` na tela. Aqui está meu código: ```swift import Cocoa class ViewController: NSViewController { @IBOutlet weak var statusLabel: NSTextField! override func viewDidLoad() { super.viewDidLoad() // Emulando um carregamento longo DispatchQueue.global().async { self.loadData() } } func loadData() { // Simulação de carregamento Thread.sleep(forTimeInterval: 2.0) let result = "Dados