Skip to content

Cannot add conformance to InspectionEmissary to Inspection class in Swift 6 #404

@jedimasterjsa

Description

@jedimasterjsa

Several errors (redacted version pasted below) pop up when following the Approach #2 instructions here. When using Swift 5 the errors go away, but the warnings still exist.

<path>/ViewInspection.swift:12:1: warning: extension declares a conformance of imported type 'Inspection' to imported protocols 'InspectionEmissary', 'Sendable'; this will not behave correctly if the owners of 'RocketTracker' introduce this conformance in the future
extension Inspection: InspectionEmissary {}
^
<path>/ViewInspection.swift:12:1: note: add '@retroactive' to silence this warning
extension Inspection: InspectionEmissary {}
^                     ~~~~~~~~~~~~~~~~~~
                      @retroactive InspectionEmissary
<path>/ViewInspection.swift:12:1: error: conformance to 'Sendable' must occur in the same source file as generic class 'Inspection'; use '@unchecked Sendable' for retroactive conformance
extension Inspection: InspectionEmissary {}
^
<App>.Inspection.notice:2:14: error: stored property 'notice' of 'Sendable'-conforming generic class 'Inspection' has non-Sendable type 'PassthroughSubject<UInt, Never>'
internal let notice: PassthroughSubject<UInt, Never>}
             ^
Combine.PassthroughSubject:2:20: note: generic class 'PassthroughSubject' does not conform to the 'Sendable' protocol
final public class PassthroughSubject<Output, Failure> : Subject where Failure : Error {
                   ^
<App>.Inspection.callbacks:2:14: error: stored property 'callbacks' of 'Sendable'-conforming generic class 'Inspection' is mutable
internal var callbacks: [UInt : (V) -> Void]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions