Swift's Optional has a take() function
Read OriginalThis article explores Swift's Optional.take() method, which returns the current value of a mutable optional if it exists and then resets the variable to nil. It compares this to the previously known Optional.toggle() method, noting that take() can save a line of code when you need to extract and clear an optional value. The article is a short technical tip for Swift developers.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser
Top of the Week
No top articles yet