mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #28130 from DougGregor/diag-rdar56710317
This commit is contained in:
25
validation-test/Sema/SwiftUI/rdar56710317.swift
Normal file
25
validation-test/Sema/SwiftUI/rdar56710317.swift
Normal 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user