-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
2
  • 1
    what swift version you use? my guess is that indexOf method appeared in swift 2.0 Commented Jul 23, 2015 at 14:00
  • 1
    @Vladimir Thank you, my mistake I use Swift 1.2 Commented Jul 23, 2015 at 14:04

1 Answer 1

3

indexOf is only available in swift 2.0

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.