Open dochoi-bot opened 3 years ago
Possibly a SwiftUI 2.0 change. Could you try running this on iOS 13?
I just installed the 13.0 simulator. and built. Here's my code
import SwiftUI
import Combine
struct ContentView: View {
let publisher = CurrentValueSubject<String, Never>("") // 2
var body: some View {
MyView(publisher: publisher.eraseToAnyPublisher())
}
}
struct MyView: View {
let publisher: AnyPublisher<String, Never>
@State var text: String = ""
@State var didAppear: Bool = false
var body: some View {
Text(text)
.onAppear { self.didAppear = true
self.text = "abc"
print(UIDevice.current.systemVersion)
}
.onReceive(publisher) {
print("onReceive")
self.text = $0
}
}
}
Something seems to be updated
Hi First of all, thank you I'm learning a lot about clean architecture for Swift UI from you
stranger-things-swiftui-state in the "Clean Architecture for SwiftUI" article, "Coordinator is history" Section In this scenario,
Scenario 2 works differently.
Here's my code.
my answer is 1...
also
my answer is "abc"...
The result is different because of SwifttUI 2.0? or I'm missing something?
Thanks