Skip to content

Disable redundant_optional_initialization SwiftLint rule #743

@insidegui

Description

@insidegui

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions