Files
swift-mirror/validation-test/Sema/SwiftUI/rdar56710317.swift
Alexis Laferrière fd191bff43 Fix test rdar56710317.swift for the iOS simulator
Fix rdar://problem/56999504
2019-11-07 15:19:46 -08:00

27 lines
743 B
Swift

// RUN: %target-typecheck-verify-swift -target x86_64-apple-macosx10.15 -swift-version 5
// REQUIRES: objc_interop
// REQUIRES: OS=macosx
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")
}
}