[Swift] 스위프트 - swift save data to temp folder(임시 폴더에 저장하기)

이미지를 기준으로 저장하려한다.

if let data = UIImageJPEGRepresentation(tempImage, 0.95){
                let tempDirectoryURL = NSURL.fileURLWithPath(NSTemporaryDirectory(), isDirectory: true)
                
                let targetURL = tempDirectoryURL.URLByAppendingPathComponent("test.jpg")

                data.writeToFile(targetURL.path!, atomically: true)

            }

이 소스면 끝!

댓글