ios - Swift 3.0: Value of type 'IndexSet' has no member 'enumerateIndexesUsingBlock' -
receiving value of type 'indexset' has no member 'enumerateindexesusingblock'
error @ enumerateindexesusingblock.
/** extension creating index paths index set */ extension indexset { /** - parameter section: section created nsindexpaths - return: array nsindexpaths */ func bs_indexpathsforsection(_ section: int) -> [indexpath] { var indexpaths: [indexpath] = [] self.enumerateindexesusingblock { (index:int, _) in indexpaths.append(indexpath(item: index, section: section)); } return indexpaths } }
the foundation type nsindexset
has enumerateindexesusingblock
method. corresponding overlay type indexset
swift 3 collection, therefore can map each index indexpath
:
extension indexset { func bs_indexpathsforsection(_ section: int) -> [indexpath] { return self.map { indexpath(item: $0, section: section) } } }
Comments
Post a Comment