KVC with NSArrays NSArrays

I have an array of arrays on which I want to use KVC (at least I think what I am doing - it seems the easiest way), but I cannot figure out how to create key paths for individual array indices. My array looks like this:

NSArray [

NSArray [0, 1, 2, 3], NSArray [4, 5, 6, 7], NSArray [8, 9, 10, 11]

]

What I want to do is get the maximum value of index 3 in the internal array. It seems like something like [outerArray valueForKey: @ "@max. [3]"] will work, but I can't understand the syntax, and my Googling was also fruitless. Am I trying to do what I am trying to do, or just write a method for this manually?

+3
source share
1 answer

Most people expect this to be, but KVC does not really allow you to consider individual array indexes. You can work with the entire array or array transformations (for example, @distinctUnionOfArrays), but you cannot access individual elements. You will need to do this "manually", so to speak.

+4
source

Source: https://habr.com/ru/post/1750945/


All Articles