CoreFoundationKit

MIT license CoreUIKit CI workflow Pod Carthage SPM

CoreFoundationKit provides helpful extensions and rich features build on top of Foundation framework.

Installation

Cocoapods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. Learn More!

pod 'CoreFoundationKit', '0.1.0'

Swift package manager

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/0vertex/CoreFoundationKit.git", .upToNextMajor(from: "0.1.0"))
]

Carthage

A simple, decentralized dependency manager for Cocoa. Learn More!

github "CoreFoundationKit" ~> 0.1.0

Documentation

Examples

  • How to setup FileOperation “`swift 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
```swift
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)
    

Learn

Following are the useful links for learning about autolayout.