CoreFoundationKit provides helpful extensions and rich features build on top of Foundation framework.
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. Learn More!
pod 'CoreFoundationKit', '0.1.0'The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. Learn More!
dependencies: [
.package(url: "https://github.com/swiftkits/CoreFoundationKit.git", .upToNextMajor(from: "0.1.0"))
]A simple, decentralized dependency manager for Cocoa. Learn More!
github "CoreFoundationKit" ~> 0.1.0- How to setup
FileOperation
let manager = FileManager.default
let rootDir = try! manager.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
let directoryOperation = FileDirectoryOperation(manager: manager, rootDir: rootDir)
let fileOperations = FileOperation(directoryManager: directoryOperation)- How to save file data into local file storage
let savedFile = try fileOperations.save(contentsOf: imageData, with: fileName)
//
// Returns
// FileItem with saved file info
//
savedFile.location // Local storage url of the file
savedFile.name // Name of the file
savedFile.data // data of the file- How delete file from local storage
try fileOperations.deleteFile(at: localFileURL)- How to fetch the saved file from local storage
try fileOperations.getFile(at: localFileURL)Following are the useful links for learning about autolayout.
Written By Manish Pandey.