SwiftUI map1 SwiftUI: map, compactMap, flatMap 3종 맵인 map, compactMap, flatMap입니다. 예제를 따라 하나씩 사용해 봅시다. map map: Returns an array containing the results of mapping the given closure over the sequence’s elements.(시퀀스의 요소에 대한 주어진 클로저를 매핑한 결과를 포함하는 배열을 반환합니다.) func map(_ transform: (Self.Element) throws -> T) rethrows -> [T] map은 클로저를 인자로 받아서 매핑한 결과를 배열로 반환해 줍니다. let cast = ["Vivien", "Marlon", "Kim", "Karl"] let lowercaseNames = cast.map { $0.lo.. 2023. 8. 11. 이전 1 다음