Can't understand why this compiles
extension HomeReducer {
@MainActor
@Observable
final class State: BaseState {
var isPresentingSubscription = false
}
}
class BaseState {}
but this gives an error
Call to main actor-isolated initializer 'init()' in a synchronous nonisolated context
extension HomeReducer {
@MainActor
@Observable
final class State {
var isPresentingSubscription = false
}
}
extension DependencyValues {
var homeView: @Sendable () -> HomeView {
HomeKey().value
}
private struct HomeKey: DependencyKey {
typealias Value = @Sendable () -> HomeView
let liveValue: Value = {
HomeView(store: Store(initialState: HomeReducer.State(), reducer: HomeReducer()))
}
let testValue: Value = {
fatalError("testValue not implemented")
}
var previewValue: Value = {
fatalError("previewValue not implemented")
}
}
}