user2021205
user2021205

Reputation:

Xcode 7.0 beta 4 not detect swift 2.0

I have installed Xcode 7.0 beta 4 but,I think Xcode will able to detect swift 2.0 function in my code

    let array = ["1", "2", "3"]
    let stringRepresentation = array.joinWithSeparator("-")
    print(stringRepresentation)

Xcode shows error " '[String]' does not have a member named 'joinWithSeparator'", as shown in below image

enter image description here

Also when I run 'xcrun swift' in terminal it show

Welcome to Apple Swift version 2.0 (700.0.47.1 700.0.59.1). Type :help for assistance.
1>  

and here I am getting stumped, not able to run swift 2.0 code.

Upvotes: 0

Views: 173

Answers (2)

Bhavin Bhadani
Bhavin Bhadani

Reputation: 22374

Swift 2.0 Xcode 7.0 beta 6 onwards uses joinWithSeparator() instead of join():

but you can get output using join

  let array = ["1", "2", "3"]
  let stringRepresentation = "-".join(array)
  print(stringRepresentation)  //output- 1-2-3  

Upvotes: 2

Eric Aya
Eric Aya

Reputation: 70118

joinWithSeparator appeared in Xcode beta 6.

Upvotes: 2

Related Questions