Closed MarshallARoss closed 2 years ago
Thanks @mikaelacaron. I kind of got it right after messaging. I reset everything and redid it. If I'm still having trouble in the future I'll hit you up!
Can you install SwiftLint, it seems you haven't and there are 4 errors related to it when building the project. Please resolve these warnings
Hi @mikaelacaron. Any attempt to shorthand these results in an error - "Binary operator '+=' cannot be applied to two 'Text' operands." Do you want to try a different approach or do you prefer I tell lint to ignore that for this function.
Hi @mikaelacaron. Any attempt to shorthand these results in an error - "Binary operator '+=' cannot be applied to two 'Text' operands." Do you want to try a different approach or do you prefer I tell lint to ignore that for this function.
@MarshallARoss Generally I don't want to comment out SwiftLint rules, but for this I'll allow it. Add // swiftlint:disable shorthand_operator
right before the extension.
Also all your comments, fix the SwiftLint warnings for those, and all the if comments, put them inside the if { }
or else { }
, not before them
// Check if # is at the beginning of a string
if prefixString == "" {
output = output + Text(" ") + hashtagText
} else if prefixString.contains("\n") {
// Check if # is at the beginning of a word preceded by blank lines
output = output + Text(" ") + Text(prefixString) + hashtagText
} else {
// if # is not at the beginning of a word do not highlight
output = output + Text(" ") + Text(String(word))
}
Also for the comment before the function use Cmd + Shift + /
which will give you this, and fill it in appropriately. This will allow your comment to show up when clicking on "quick help"
/// Description
/// - Parameter tweet:
/// - Returns:
On your Tweet+Extension
you don't need to put Optional
in front of everything, and and use line breaks to fix most of the line length violation warnings
@MarshallARoss I found an edge case, this tweet: the #help...
is highlighted when only the #help
should be highlighted
Updated and resubmitted. #164
Progress / Closed on issue #82 Highlight Hashtags
What it Does
How I Tested
Screenshot