Finding maximum numeric value in NSArray

前端 未结 4 962
旧时难觅i
旧时难觅i 2020-12-12 13:09

I have an NSArray of NSNumbers and want to find the maximum value in the array. Is there any built in functionality for doing so? I am using iOS4 GM if that makes any differ

4条回答
  •  温柔的废话
    2020-12-12 13:34

    Here is the swift version

    let maxValue =  (numbers.value(forKeyPath: "@max.self") as! Double)
    

提交回复
热议问题