Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible false positive with for_where (SwiftLint 0.17.0) #1404

Closed
Coeur opened this issue Mar 29, 2017 · 1 comment
Closed

possible false positive with for_where (SwiftLint 0.17.0) #1404

Coeur opened this issue Mar 29, 2017 · 1 comment

Comments

@Coeur
Copy link

Coeur commented Mar 29, 2017

I got this code to find the previous item of an item which satisfies a condition:

func keyInputLeftArrow(_ keyInput: UIKeyInput) {
    var previousItem: CodeSelectTextField? = nil
    for item in codeInput.subviews as! [CodeSelectTextField] {
        if item.isFirstResponder {
            previousItem?.becomeFirstResponder()
            return
        }
        previousItem = item
    }
}

I'm not sure it can be rewritten using where. Maybe the SwiftLint warning shouldn't trigger when there are statements after the if (like previousItem = item in my example).

screen shot 2017-03-29 at 19 08 39

@Coeur
Copy link
Author

Coeur commented Mar 29, 2017

Oh, duplicate of #1387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant