Open
Description
Consider:
$ cat /tmp/a.mm
- (void)setSearchBarText:(NSString*)text {
_searchBar.text = text;
if ([_searchBar.delegate respondsToSelector:@selector(searchBar:textDidChange:)]) {
[_searchBar.delegate searchBar:_searchBar textDidChange:text];
}
}
$ build/bin/clang-format /tmp/a.mm
- (void)setSearchBarText:(NSString *)text {
_searchBar.text = text;
if ([_searchBar.delegate respondsToSelector:@selector(searchBar:
textDidChange:)]) {
[_searchBar.delegate searchBar:_searchBar textDidChange:text];
}
}
To break the long line, clang-format aligned searchBar:
and textDidChange:
on the colons, but breaking up the @selector(searchBar:textDidChange:)
argument doesn't seem great. Perhaps it would have been better to break the line before respondsToSelector:
instead, something like:
- (void)setSearchBarText:(NSString*)text {
_searchBar.text = text;
if ([_searchBar.delegate
respondsToSelector:@selector(searchBar:textDidChange:)]) {
[_searchBar.delegate searchBar:_searchBar textDidChange:text];
}
}