Answers for "swift 5 flatMap wtih keypath"

0

swift 5 flatMap wtih keypath

func flatMap<T>(_ keyPath: KeyPath<Element, [T]>) -> [T] {
    return self.flatMap { $0[keyPath: keyPath] }
}

let dependentItems = item.dependencies.flatMap(\.items)
Posted by: Guest on April-23-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language