In Objective C, is there a one-liner or something small to remove (shorten by one) and return the first element of an array, regardless of its index?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know of a method that returns the item removed, but you can do this using a combination of
NSArray#objectAtIndex:0andNSMutableArray#removeObjectAtIndex:0. I suppose you could introduce a new method category onNSMutableArraythat implements ashiftmethod.