Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

swift2 - Cannot invoke `join` with an argument list of type (String, [String]) in Swift 2.0

var specializationTitles = ["a", "b", "c", "d"]
let outputString = join(" / ", specializationTitles)

got an error:

Cannot invoke join with an argument list of type (String, [String])

How to solve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
let separator = " / "
let outputString = separator.join(specializationTitles)

With Xcode7beta6:

specializationTitles.joinWithString(" / ")

With Xcode7 release version:

specializationTitles.joinWithSeparator(" / ")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...