Skip to content

Replace objc string methods with swift equivalents #2292#2491

Merged
nicklockwood merged 1 commit intonicklockwood:developfrom
sutheesh:develop
Apr 6, 2026
Merged

Replace objc string methods with swift equivalents #2292#2491
nicklockwood merged 1 commit intonicklockwood:developfrom
sutheesh:develop

Conversation

@sutheesh
Copy link
Copy Markdown
Contributor

@sutheesh sutheesh commented Apr 6, 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.

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
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.30%. Comparing base (3a5f598) to head (b889a7a).
⚠️ Report is 1 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nicklockwood nicklockwood merged commit e92eabf into nicklockwood:develop Apr 6, 2026
16 checks passed
@nicklockwood
Copy link
Copy Markdown
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.
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