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.

0

2 Answers 2

2

joinWithSeparator appeared in Xcode beta 6.

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

Comments

2

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 

2 Comments

I am using 'alamofire' and it uses 'joinWithSeparator', and they say it's working on swift 2.0 and I am getting error
yes but you are using xcode 7.0 beta 4.0 and method joinWithSeparator you can use xcode 7.0 beta 6.0 onwards...you can use Join instead and it will work for sure