malena
malena

Reputation: 948

Can't find FileManager Swift class in Foundation, where is it?

The Apple documentation talks about the Swift class FileManager, but Xcode is not recognizing it as part of Foundation, I get the error below. Where is this class then?

It says Use of unresolved identifier 'FileManager'. I thought this was a new API that would replace NSFileManager.

enter image description here

Btw, the app documentation that talks about it is here: FileManager class

Upvotes: 2

Views: 4723

Answers (2)

codersl
codersl

Reputation: 2332

You need to "import Foundation" before using the FileManager class.

import Foundation

let fileManager = FileManager()

Upvotes: 7

Amit Jagesha シ
Amit Jagesha シ

Reputation: 1112

I think it's NSFileManager()

let fileManager =  NSFileManager.defaultManager()

Upvotes: 0

Related Questions