I have one NSMutableDictionary
with different keys and values. All key values I need to save in NSMutableArray
in Swift3.
Here is my NSMutableDictionary
:
{
92 = (
"<Group.VideoRange: 0x6040003a09a0>",
"<Group.VideoRange: 0x6040003a0c40>"
);
93 = (
"<Group.VideoRange: 0x6040003a0540>"
);
}
Note: Here 92 and 93 is my dictionary keys.
Below is my code to add dictionary all values in my array.
for value in videoRangeDic.allValues{
arrVideoRange.add(value)
}
As an output, I am getting below array value :
(
(
"<Group.VideoRange: 0x6040003a0540>"
),
(
"<Group.VideoRange: 0x6040003a09a0>",
"<Group.VideoRange: 0x6040003a0c40>"
)
)
Instead, I want my output should be like :
(
"<Group.VideoRange: 0x6040003a0540>",
"<Group.VideoRange: 0x6040003a09a0>",
"<Group.VideoRange: 0x6040003a0c40>"
)
The reason is dictionary is saving values in array like (), So I just need to remove this array. Can anyone please help me to solve my problem without creating any new array. Thank you!
If your arrVideoRange
is NSMutableArray
like this
var arrVideoRange : NSMutableArray = []
then try this
for value in videoRangeDic.allValues{
arrVideoRange.addObjects(from: value as [Any])
}