Skip to content

Commit

Permalink
Apply suggestions from code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebRas committed Nov 15, 2024
1 parent 1a13ea0 commit 49e992d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Shared/Supporting Files/Views/SampleLink.swift
Original file line number Diff line number Diff line change
@@ -134,13 +134,10 @@ private extension String {
var attributedString = AttributedString(self)

let trimmedSubstring = substring.trimmingCharacters(in: .whitespacesAndNewlines)
if let range = localizedStandardRange(of: trimmedSubstring) {
let substring = self[range]

if let boldedSubstring = try? AttributedString(markdown: "**\(substring)**"),
let attributedRange = attributedString.range(of: substring) {
attributedString.replaceSubrange(attributedRange, with: boldedSubstring)
}
if let range = localizedStandardRange(of: trimmedSubstring),
let boldedSubstring = try? AttributedString(markdown: "**\(self[range])**"),
let attributedRange = attributedString.range(of: self[range]) {
attributedString.replaceSubrange(attributedRange, with: boldedSubstring)
}

return attributedString

0 comments on commit 49e992d

Please sign in to comment.