Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RegeributedTextView/Classes/RegeributedTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ open class RegeributedTextView: UITextView {

fileprivate var tapAttributedTextGesture: UITapGestureRecognizer?

private var _delegate: RegeributedTextViewDelegate?
private weak var _delegate: RegeributedTextViewDelegate?

private var attributedRanges: [AttributedRange] = [] {
didSet {
Expand Down
2 changes: 1 addition & 1 deletion RegeributedTextView/Classes/StringExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension String {
// Returns matched range list by regular expression.
func matched(by regex: String) -> [Range<String.Index>] {
let result = try? NSRegularExpression(pattern: regex, options: [])
.matches(in: self, options: [], range: NSRange(location: 0, length: self.count))
.matches(in: self, options: [], range: NSRange(location: 0, length: self.utf16.count))
.flatMap{ $0.range(at: 0).range(for: self) }
return result ?? []
}
Expand Down