Open bisgardo opened 1 year ago
test.swift:33:69: error: type '()' cannot conform to 'View'
ToolbarItem(placement: .confirmationAction) {
^
test.swift:33:69: note: only concrete types such as structs, enums and classes can conform to protocols
ToolbarItem(placement: .confirmationAction) {
^
test.swift:33:69: note: required by static method 'buildBlock' where 'Content' = '()'
ToolbarItem(placement: .confirmationAction) {
^
test.swift:33:25: error: type '()' cannot conform to 'View'
ToolbarItem(placement: .confirmationAction) {
^
test.swift:33:25: note: only concrete types such as structs, enums and classes can conform to protocols
ToolbarItem(placement: .confirmationAction) {
^
test.swift:33:25: note: required by referencing initializer 'init(placement:content:)' on 'ToolbarItem' where 'Content' = '()'
ToolbarItem(placement: .confirmationAction) {
This is what happens with Swift 5.9-dev (c1d5118c21da49a), which is definitely an improvement, but still subpar.
A small example to reproduce this exact diagnosis:
import SwiftUI
let _ = ToolbarItem(placement: .confirmationAction) {
_ = false
}
Description
I'm following the Scrumdinger tutorial, made a small error and got the error message:
Steps to reproduce
Try to compile the tutorial project as of having just added the "Edit" sheet, where the file DetailView.swift is:
The error is in line 56 (inside the second
ToolbarAction
), where the expression should have been wrapped in aButton
.Expected behavior
An error message explaining the actual problem (that the closure should return a
Content
value).Environment
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100) Target: arm64-apple-macosx13.0
Xcode 14.3, Build version 14E222b
iOS 16.4