Find first element matching condition in Swift array (e.g. EKSource)

前端 未结 7 1579
迷失自我
迷失自我 2020-12-24 05:35

I would like to find the first EKSource of type EKSourceType.Local with a \"single\"-line expression in Swift. Here is what I currently have:

相关标签:
7条回答
  • 2020-12-24 06:34

    Let's try something more functional:

    let arr = [0,1,2,3]
    let result = arr.lazy.map { print("                                                                    
    0 讨论(0)
提交回复
热议问题