Answers for "map array swift"

0

swift array map example

swift 5
// taken from developer.apple.com map(_:)
let cast = ["Vivien", "Marlon", "Kim", "Karl"]
let lowercaseNames = cast.map { $0.lowercased() }
// 'lowercaseNames' == ["vivien", "marlon", "kim", "karl"]
let letterCounts = cast.map { $0.count }
// 'letterCounts' == [6, 6, 3, 4]
Posted by: Guest on September-29-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language