gpt4 book ai didi

ios - "Computed property must have an explicit type"错误 : how to list files in Swift 2. x?

转载 作者:行者123 更新时间:2023-11-28 11:11:34 28 4
gpt4 key购买 nike

<分区>

以下代码生成一个Computed property must have an explicit type error.

使用新的 try/catch Swift 语法列出文件的正确方法是什么?

do {
let files = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(docsPath as String) as! [String] {
print("Found \(files.count) file(s) in \(docsPath):")
}catch{
print("Error with listing files: \(error)")
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com