Reputation:
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
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
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