Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme is outdated #114

Open
gerchicov-vg opened this issue Jul 2, 2024 · 0 comments
Open

Readme is outdated #114

gerchicov-vg opened this issue Jul 2, 2024 · 0 comments

Comments

@gerchicov-vg
Copy link

Just added this chunk of code and tried to run:

class MarkdownSubreddit: MarkdownLink {

  private static let regex = "(^|\\s|\\W)(/?r/(\\w+)/?)"

  override var regex: String {
    return MarkdownSubreddit.regex
  }

  override func match(match: NSTextCheckingResult,
                             attributedString: NSMutableAttributedString) {
    let subredditName = attributedString.attributedSubstringFromRange(match.rangeAtIndex(3)).string
    let linkURLString = "http://reddit.com/r/\(subredditName)"
    formatText(attributedString, range: match.range, link: linkURLString)
    addAttributes(attributedString, range: match.range, link: linkURLString)
  }

}

Errors:

Argument labels for method 'match(match:attributedString:)' do not match those of overridden method 'match(_:attributedString:)'
'attributedSubstringFromRange' has been renamed to 'attributedSubstring(from:)'
'rangeAtIndex' has been renamed to 'range(at:)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant