Post

Replies

Boosts

Views

Activity

Comment on Strange crash when using .values from @Published publisher
Ah sorry for not asking clearly. I know adding receive(on: DispatchQueue.main) or subscribe(on: DispatchQueue.main would fix this. I know $0 which is the @Published is accessed in background (map function in this case). What I don't understand are: Why the map run on background, not on main? Why there is discrepancy in iOS 18 and iOS 17 and below. And interestingly, I observe that the map function run on background only the first time, perhaps the subscription is done in background?
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’24