Skip to main content

Swift 5.7: Shorthand for optional unwrapping

Updated 1 min readMarkdown
Part of seriesSwift Tips
Swift 5.7: Shorthand for optional unwrapping

Swift 5.7 comes with a new feature that saves our time

To unwrap an optional value we used to do

if let username = username {
  print(usernname)
}

After Swift 5.7 new shorthand, we can easily do

if let username {
  print(usernname)
}

Without repeating the variable name again

Start using the new shorthand and save your time!

118 views

About the author

  • iOS Software Engineer (Swift, SwiftUI) with +4 years of experience working with international teams and clients, Published +10 apps, seeking to build world-class apps

No comments yet. Be the first to comment.