reports icon indicating copy to clipboard operation
reports copied to clipboard

FB17595840: Condition about override in NSSecureCoding documentation doesn’t make sense in Swift

Open douglashill opened this issue 8 months ago • 0 comments

Submission Date

2025-05-13

Status

Open

Area

Developer Documentation

Operating System Version

N/A

Type

Incorrect/Unexpected Behavior

Description

What does the documentation issue you are reporting involve?

Technology Documentation

Please provide the URL of the content you are reporting an issue with:

https://developer.apple.com/documentation/foundation/nssecurecoding

Description

This documentation says:

An object that does not override init(coder:) can conform to NSSecureCoding without any changes (assuming that it is a subclass of another class that conforms). An object that does override init(coder:) must decode any enclosed objects using the decodeObjectOfClass:forKey: method. For example:

However the Swift compiler enforces that init(coder:) is overridden, so this distinction doesn’t make sense.

Instead, it‘s the case that all Swift subclasses of classes that conform to NSSecureCoding must override both init(coder:) and supportsSecureCoding, even if those overrides simply call super (or return true for the latter).

Keywords

No response

Prerequisites

  • [x] The title follows the format FB<number>: <title>
  • [x] I will keep this issue updated with Apple's responses

douglashill avatar May 13 '25 15:05 douglashill