NSView init(coder:) should have parameter name `decoder`

Originator:mayoff
Number:rdar://32697803 Date Originated:10-Jun-2017 11:17 PM
Status:CLOSED Resolved:
Product:macOS + SDK Product Version:Version 9.0 beta (9M136h) / 10.13 Beta (17A264c)
Classification:Enhancement Reproducible:Always
 
Summary:
Dear AppKitterinos,

NSView declares the following required initializer:

    public init?(coder: NSCoder)

This means that when I create a subclass of NSView, Xcode generates (either as a fix-it or by code completion) this method definition:

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

However, the argument is really only useful for *decoding*, so it would be nice if it used parameter name `decoder`. That is, I want to define the method like this:

    required init?(coder decoder: NSCoder) {
        super.init(coder: decoder)

        someRect = decoder.decodeRect(forKey: "someRect")
    }

Rather than me manually adding the `decoder` parameter name every time I write an NSView subclass, I would like you to change the declaration in NSView to this:

    public init?(coder decoder: NSCoder)

Thanks,
Rob



Steps to Reproduce:
 

Expected Results:
 

Actual Results:
 

Version:
Version 9.0 beta (9M136h) / 10.13 Beta (17A264c)

Notes:

Comments

Apple Developer Relations Jul 18 2017 Please verify this issue with the macOS 10.13 beta and update your bug report at https://bugreport.apple.com/ with your results.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!