当我尝试在操场上运行时,为什么我会在第16行(下面的最后一行)收到错误“join is unavailable:call the joinWithSeparator()”?而且,我该如何解决它?
原文链接:https://www.f2er.com/swift/319876.htmlclass Person { var firstName: String? var lastName: String? let gender = "female" func fullName() -> String { var parts: [String] = [] if let firstName = self.firstName { parts += [firstName] } if let lastName = self.lastName { parts += [lastName] } return " ".join(parts) } }