Created
May 20, 2022 09:29
-
-
Save TonyTang2001/cde24da8bbb80a1c98a42aae2d3af9f0 to your computer and use it in GitHub Desktop.
Get Multiple Elements from Array with Indices
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
let result = indicesArray.compactMap { (elementArray.count > $0) ? elementArray[$0] : nil} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment