-2

Array does not perform a command in swift

I show a simple example

    var array = ["x", "y", "z"]
    var index = array.indexOf("y")

I get an error '[String]' does not have a member named 'indexOf'

I saw this question but it doesn't help me.

I imported

import UIKit
import Foundation
import AVFoundation
import CoreAudio
import MediaPlayer
import AVKit
Community
  • 1
  • 1
Alexander Khitev
  • 6,417
  • 13
  • 59
  • 115

1 Answers1

3

indexOf is only available in swift 2.0

Swinny89
  • 7,273
  • 3
  • 32
  • 52