Find maximum integer value in array of dictionaries

Hi guys,

 

I have an array of dictionaries which with following sample data:

 

var dictArray = [["totalRating":100,"uid":"Id-1"],["totalRating":200,"uid":"Id-2"],["totalRating":20,"uid":"Id-4"]]

 

How do I get the single dictionary object with the max “totalRating”?

Note: I am using Swift 4.1

 

Thanks in advance!

Powered by WPeMatico

About

You may also like...

Comments are closed.