WEBVTT 00:06.610 --> 00:13.240 In this video you're gonna learn another great E6 feature this parade operator so let's understand the 00:13.240 --> 00:17.080 need for such an operator before diving in. 00:17.080 --> 00:25.080 So let's go for a simple example where you use the method men of the math object. 00:25.960 --> 00:35.800 So if you try 3 by 1 3 6 9 for example then you know that the result is going to be three and that's 00:35.800 --> 00:39.600 the minimum of these numbers. 00:39.600 --> 00:50.430 Now what if you pause and the way to the main function what do you think you're gonna get. 00:50.430 --> 00:52.660 You don't get the correct results. 00:52.740 --> 01:01.580 Now we want to be able to pass an array to our function men and still gets the correct results. 01:01.650 --> 01:06.030 Now in iOS 5 there was a way to do that. 01:06.670 --> 01:14.740 If you remember you could use the function apply and bus the value of this. 01:14.880 --> 01:20.050 And also arguments inside and right like this 01:26.240 --> 01:33.680 so apply with a quick reminder we'll call a function where they're given this value which you specify 01:34.070 --> 01:37.660 and then you pass the arguments in array. 01:37.670 --> 01:40.490 So now this is not important here. 01:40.520 --> 01:51.720 So we can just set it to know and we are interested in this array which should be converted to a list 01:51.750 --> 01:54.290 of arguments used by the function. 01:54.780 --> 01:57.930 So let's see if we get the correct result this time. 01:57.990 --> 02:00.380 And here we go that works. 02:00.590 --> 02:00.980 All right. 02:00.990 --> 02:11.180 Now in E6 you can use the spread operator which will make your coding a lot easier in this scenario. 02:11.210 --> 02:12.330 So how does it work. 02:12.350 --> 02:25.190 So you can actually use the array straightaway like once but with the spread operator just before the 02:25.190 --> 02:26.840 array. 02:27.020 --> 02:32.660 So this operator will turn your array to a list of arguments. 02:33.210 --> 02:38.310 And if you try you get the correct result okay. 02:38.560 --> 02:49.610 So this works as well if you place an array inside a list of arguments. 02:49.610 --> 03:03.630 So let's say that you cause an array three four and 17 for example and you place this array X inside 03:04.110 --> 03:05.820 a list of other elements 03:11.610 --> 03:20.340 so all you need to do is use the spread operator just before X and now the list of elements inside X 03:20.340 --> 03:26.120 is going to be injected inside your list of arguments and you get the correct results. 03:26.130 --> 03:32.540 Now you can also use the Express operator to inject elements of an array inside another array. 03:32.850 --> 03:35.700 So let's say that you of course in array 03:38.350 --> 03:47.050 1 3 6 5 and you want to inject the array X inside this array. 03:47.050 --> 03:55.930 So to do this all you need to do is go to the position where you'd like to insert X and place X there 03:56.530 --> 04:03.580 like this and use this parade operator just before X and now you'll see that you're just injected all 04:03.580 --> 04:09.330 the elements of X in that or that position. 04:09.970 --> 04:10.240 Right. 04:10.280 --> 04:19.100 So that's how the spread operator can make your coding easier in the next video you will explore more 04:19.130 --> 04:22.930 iOS 6 features that you can use when working with objects.