WWDC icon indicating copy to clipboard operation
WWDC copied to clipboard

Disable redundant_optional_initialization SwiftLint rule

Open insidegui opened this issue 6 months ago • 0 comments

There are quite a few property wrappers that fail to build unless the property is explicitly initialized with nil, for example:

// Fails to build
@Invalidating(.layout)
var image: NSImage?
// Builds successfully
@Invalidating(.layout)
var image: NSImage? = nil

This can be solved locally with a comment, but it's annoying and ugly:

@Invalidating(.layout)
// swiftlint:disable:next redundant_optional_initialization
var image: NSImage? = nil

I think the better approach would be to disable the rule globally.

insidegui avatar Aug 23 '25 11:08 insidegui