Я хотел бы знать, как я могу создать URL-адрес из строки пути.Вот мой код:
let completePath = "/Volumes/MyNetworkFolder/"
do {
let items = try FileManager.default.contentsOfDirectory(atPath: completePath)
for item in items {
if item.hasDirectoryPath { //String has no member hasDirectoryPath
itemList.append(item)
}
}
} catch {
print("Failed to read dir")
let buttonPushed = dialogOKCancel(question: "Failed to read dir", text: "Map the network folder")
if(buttonPushed) {
exit(0)
}
}
Я бы хотел добавить только папки в массив itemList.HasDirectoryPath является методом URL.Как я могу изменить свой код, чтобы URL-адреса не были строковыми.
Заранее благодарю за любую помощь, которую вы можете предоставить.