2

I cannot find map in Swift. Anyone knows how to resolve this issue?

Use of unresolved identifier 'map'

enter image description here

I was trying to run this code

Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256

1 Answers1

7

That is quite old Swift. map() used to be a global function in early Swift versions, but (like other global functions such as filter, index, ...) has been replaced by an instance method of the Sequence protocol in Swift 2:

let a = stride(from:0 , to: sections, by: 1).map {
    stride(from:$0 , to: tempDataSource.count, by: sections).map {
        tempDataSource[$0]
    }
}

For more information, see for example

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
  • Could you also have a look at this? https://stackoverflow.com/questions/55910290/avaudiosession-plays-sound-on-receiver-or-mic-switches-to-front?noredirect=1#comment98576729_55910290 – Spring May 03 '19 at 16:03