Post

Replies

Boosts

Views

Activity

Reply to Observation and MainActor
I wonder as well. I have this code that I'm not sure what will be the behavior now: import Foundation import Combine import SwiftUI @Observable open class BaseViewmodel { var cancellation = [AnyCancellable]() public init() { print("Init: \(self)") } deinit { print("Deinit: \(self)") } } and: @Observable @MainActor class HomeViewModel: BaseViewmodel { override init() { super.init() } } if I'll add @MainActor to the base class I will get same error: Call to main actor-isolated initializer 'init()' in a synchronous nonisolated context
Aug ’23