Merge pull request #28130 from DougGregor/diag-rdar56710317

This commit is contained in:
swift-ci
2019-11-07 11:05:07 -08:00
committed by GitHub

View File

@@ -0,0 +1,25 @@
// RUN: %target-typecheck-verify-swift -target x86_64-apple-macosx10.15 -swift-version 5
// REQUIRES: objc_interop
import SwiftUI
import Combine
final class MyObservableObject: ObservableObject {
@Published private(set) var isDoingTheThing = false
}
struct MyView: View {
@EnvironmentObject var observableObject: MyObservableObject
var body: some View {
MyBindingView(doTheThing: $observableObject.isDoingTheThing) // expected-error{{cannot assign to property: 'isDoingTheThing' setter is inaccessible}}
}
}
struct MyBindingView: View {
@Binding var doTheThing: Bool
var body: some View {
Text(doTheThing ? "Doing The Thing" : "Doing Sweet Nothing")
}
}