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

String NSRange extension #499

Merged
merged 2 commits into from
Sep 14, 2023
Merged

String NSRange extension #499

merged 2 commits into from
Sep 14, 2023

Conversation

mallexxx
Copy link
Collaborator

@mallexxx mallexxx commented Sep 8, 2023

Please review the release process for BrowserServicesKit here.

Required:

Task/Issue URL: https://app.asana.com/0/1177771139624306/1205421610519119/f
iOS PR: duckduckgo/iOS#1989
macOS PR: duckduckgo/macos-browser#1610
What kind of version bump will this require?: Minor

Optional:

  • refactored String NSRange helpers to use designated functions

Description:

  • see macOS PR

Copy link
Contributor

@tomasstrba tomasstrba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ✅

Adding few unit tests would help here, but not a blocker.

@mallexxx
Copy link
Collaborator Author

I don‘t see a need or for what to add tests for the changes of this PR, no logics were added.

@mallexxx mallexxx merged commit 7ae1806 into main Sep 14, 2023
@mallexxx mallexxx deleted the alex/string-nsrange branch September 14, 2023 08:48
@tomasstrba
Copy link
Contributor

As an example, I see new implementations of properties and methods in StringProtocol. Perfect candidates for unit tests.

public extension StringProtocol {

    // MARK: NSRange

    var fullRange: NSRange {
        NSRange(startIndex..<endIndex, in: self)
    }

    func length() -> Int {
        self.fullRange.length
    }

    subscript (_ range: NSRange) -> Self.SubSequence? {
        Range(range, in: self).map { self[$0] }
    }

mallexxx added a commit to duckduckgo/macos-browser that referenced this pull request Sep 14, 2023
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

Successfully merging this pull request may close these issues.

2 participants