optional type1 Initializer for conditional binding must have Optional type, not 'String' 상단의 코드에서 if let docuPath = directory.path로 잡아주게 되면 제목과 같이 조건부 바인딩의 초기자(initializer)는 옵셔널형이어야하며, String일수 없다는 에러가 뜹니다. 있을지 없을지도 모르는데 어떻게 저렇게 쓰니? 하는 것이죠... let docuPath = directory.path if !docupath.isEmpty { let fileNames = try FileManager.default.contentsOfDirectory(atPath: docuPath) for fileName in fileNames { if fileName == named { let filePathName = "\(docuPath)/ \(fileName)" try FileManager... 2022. 12. 22. 이전 1 다음