-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
enhancementIdeas for improvements of existing features and rules.Ideas for improvements of existing features and rules.
Description
New Issue Checklist
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Bug Description
Using . isToggle in an app that supports a version before iOS 17 requires an if #available, which breaks this lint rule. Example:
struct ContentView: View {
var body: some View {
Text("Hello, World!")
.onTapGesture {
print("foo")
}
.accessibilityAddTraits({
if #available(iOS 17, *) {
[.isToggle, .isButton]
} else {
.isButton
}
}())
}
}Mention the command or other SwiftLint integration method that caused the issue. Include stack traces or command output.
$ swiftlint lint --strict
Linting Swift files in current working directory
Linting 'TestApp.swift' (2/2)
Linting 'ContentView.swift' (1/2)
~/Desktop/test/test/ContentView.swift:12:9: error: Accessibility Trait for Button Violation: All views with tap gestures added should include the .isButton or the .isLink accessibility traits (accessibility_trait_for_button)
Done linting! Found 1 violation, 1 serious in 2 files.Environment
- SwiftLint version:
$swiftlint version
0.63.1- Xcode version:
$xcodebuild -version
Xcode 26.2
Build version 17C52- Installation method used: Homebrew
- Configuration file:
# Ran in minimal setup to test
opt_in_rules:
- accessibility_trait_for_buttonAre you using nested configurations? No
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementIdeas for improvements of existing features and rules.Ideas for improvements of existing features and rules.