I have a question to make me puzzle why refresh UI must be in main thread?
There could be many reasons, but I believe the primary reason is that UI frameworks (both UIKit and SwiftUI) are not thread safe, and are not designed to be thread safe — there would probably be too many compromises affecting performance, not to mention that its development would be a lot more complicated.