swift - enumerateObjects failing on NSOrderedSet -
in swift 2 able this:
let foo = nsorderedset() foo.enumerateobjects { obj, idx, _ in ... }
in swift 3 i'm getting error
ambiguous use of 'enumerateobjects'
i'm not sure why error happening, or how fix.
try this:
let foo = nsorderedset(array: [1, 2, 3, 1, 1, 6, 1]) (offset,element) in foo.enumerated() { print(offset) print(element) }
you can using foreach follow:
foo.enumerated().foreach { print($0.offset) print($0.element) }
using enumerateobjects correct syntax be:
foo.enumerateobjects({ (obj, idx, _) in print(obj) print(idx) })
Comments
Post a Comment