Skip to content

First Where Violation when using filter first #254

Description

@LucasVanDongen

So I have this slightly redacted piece of code:

self.webSocketHandler.isConnected.filter { $0 }.first().observeNext { _ in }

It's giving me the following warning (not sure if it's SwiftLint or vanilla Xcode though...):

First Where Violation: Prefer using .first(where:)over.filter { }.first in collections. (first_where)

However the first(where:) method doesn't seem to exist in that context.

It's not a big issue and perhaps I'm overlooking a better way to do it but it would be nice if it would actually have first(where:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions