/Users/alexik/Documents/Programming/Swift/college-app/College App Test/ConversationDialogViewController.swift:394:50: 'split(_:maxSplit:allowEmptySlices:isSeparator:)' is unavailable: Use the split() method instead.
let name = "Bestand: " + split(json["name"].string!) {$0 == "/"}[1]
我在 Stack Overflow 上没有看到同样的问题。有很多这样的例子:
string[] lines = entry_text.Split(new string[] {"\n"}, StringSplitOptions.None);
最佳答案
split
不再是全局函数。它现在是集合类型的扩展。在你的情况下,你会这样调用它:
let name = "Bestand: " + String(json["name"].string!.characters.split { $0 == "/" }[1])
关于swift - 使用向下转换 "!"拆分 json 字符串不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37262375/