Replace objc string methods with swift equivalents #2292#2491
Merged
nicklockwood merged 1 commit intonicklockwood:developfrom Apr 6, 2026
Merged
Replace objc string methods with swift equivalents #2292#2491nicklockwood merged 1 commit intonicklockwood:developfrom
nicklockwood merged 1 commit intonicklockwood:developfrom
Conversation
Add preferSwiftStringAPI rule (nicklockwood#2292) Replaces the Objective-C bridged `replacingOccurrences(of:with:)` with Swift-native `replacing(_:with:)`. The ObjC method has known Unicode bugs (e.g. corrupting emoji flag sequences); the Swift equivalent is safer, shorter, and available from Swift 5.7+. Only the two-argument form is transformed — calls with `options:` or `range:` are left unchanged as they have no direct Swift equivalent.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2491 +/- ##
===========================================
- Coverage 95.30% 95.30% -0.01%
===========================================
Files 167 168 +1
Lines 25349 25381 +32
===========================================
+ Hits 24160 24190 +30
- Misses 1189 1191 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Owner
|
Looks great, thanks! |
calda
pushed a commit
that referenced
this pull request
Apr 11, 2026
Add preferSwiftStringAPI rule (#2292) Replaces the Objective-C bridged `replacingOccurrences(of:with:)` with Swift-native `replacing(_:with:)`. The ObjC method has known Unicode bugs (e.g. corrupting emoji flag sequences); the Swift equivalent is safer, shorter, and available from Swift 5.7+. Only the two-argument form is transformed — calls with `options:` or `range:` are left unchanged as they have no direct Swift equivalent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add preferSwiftStringAPI rule (#2292)
Replaces the Objective-C bridged
replacingOccurrences(of:with:)with Swift-nativereplacing(_:with:). The ObjC method has known Unicode bugs (e.g. corrupting emoji flag sequences); the Swift equivalent is safer, shorter, and available from Swift 5.7+.Only the two-argument form is transformed — calls with
options:orrange:are left unchanged as they have no direct Swift equivalent.