DEV Community

Cover image for If let shorthand project wide refactoring using Xcode regex search & replace.
Daniel Tavares
Daniel Tavares

Posted on

3 1

If let shorthand project wide refactoring using Xcode regex search & replace.

Swift 5.7 introduced this beauty (if let shorthand)
https://github.com/apple/swift-evolution/blob/main/proposals/0345-if-let-shorthand.md

You can leverage the power of regex in Xcode search and replace bar to refactor your projects codebase.

Search:

if let (\w+) = (\1) \{

Replace:

if let $1 \{

Xcode Regex Search & Replace

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay