File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
validation-test/Sema/SwiftUI Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -target x86_64-apple-macosx10.15 -swift-version 5
2
+ // REQUIRES: objc_interop
3
+
4
+ import SwiftUI
5
+ import Combine
6
+
7
+ final class MyObservableObject : ObservableObject {
8
+ @Published private( set) var isDoingTheThing = false
9
+ }
10
+
11
+ struct MyView : View {
12
+ @EnvironmentObject var observableObject : MyObservableObject
13
+
14
+ var body : some View {
15
+ MyBindingView ( doTheThing: $observableObject. isDoingTheThing) // expected-error{{cannot assign to property: 'isDoingTheThing' setter is inaccessible}}
16
+ }
17
+ }
18
+
19
+ struct MyBindingView : View {
20
+ @Binding var doTheThing : Bool
21
+
22
+ var body : some View {
23
+ Text ( doTheThing ? " Doing The Thing " : " Doing Sweet Nothing " )
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments