1

I have query regarding objectEnumrator in Swift. I am converting my code from Objective-C to Swift. In Objective-C, I am able to get enumerator by following ways // Create enumerators

  NSEnumerator *jsonEnumerator = [mySortedArray objectEnumerator];
  NSDictionary *objectDictionary = [jsonEnumerator nextObject];

mySortedArray is array of dictionary.

Could you please let me know how can I do this in swift? I am trying to get mySortedArray.enumerator() but gives me an enumerator sequence.

Any idea or suggestion would be great.

2
  • I'm not very sure what you mean. Perhaps mySortedArray.enumerate()? Or var array = mySortedArray.generate() -> let object = array.next()? Commented Apr 7, 2016 at 7:25
  • It depends on what you are going to accomplish... Commented Apr 7, 2016 at 7:26

1 Answer 1

1

You can use NSMutableSet for objectEnumerator.

For example:

var mySortedArray = NSMutableSet()
let jsonEnumerator: NSEnumerator = mySortedArray.objectEnumerator()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.