TextFieldStyle and SwiftLint

I ran into a problem today where SwiftLint was mad at TextFieldStyle because it has you implement the public func _body function which doesn’t start with a lower case letter like the identifier_name rule wants.

The fix was to put this comment right above the function signature:

// swiftlint:disable:next identifier_name
func _body(configuration: TextField<Self._Label>) -> some View {

And here’s the raw error that the compiler was throwing:

Identifier Name Violation: Function name should start with a lowercase character: '_body(configuration:)' (identifier_name)

March 10, 2022