A library that helps developers to easily perform file-related operations In iOS

Overview

File Operations Preview

Build Status Documentation Status codecov Maintenance

GitHub license GitHub contributors

A library that helps developers to easily perform file-related operations. In iOS,

We write our files mainly into three directories Documents Directory, Temporary Directory, Cache Directory

Requirements

File Operations Version 0.0.15
iOS Version 10.0+
Xcode 10+
Swift 4.2

Installation

Package Manager

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.

The Package Manager is included in Swift 3.0 and above.

https://github.com/rintoandrews90/FileOperations-Swift

Directory Types

DirectoryPath defines three directories which commonly used in our iOS application

  1. Documents Directory

  2. Temporary Directory

  3. Cache Directory

URL Methods

Get Document Directory URL

let documentDirectoryURL = FileOperations.getDocumentDirectoryURL()

Get Temporary Directory URL

let temporaryDirectoryURL =  FileOperations.getTemporaryDirectoryURL()

Get Cache Directory URL

let cacheDirectoryURL = FileOperations.getCacheDirectoryURL()

Directory Methods

Delete all contents of Directory Path

try? FileOperations.clearDirectory(path: .document)

Create directory in document/temp/cache directory with given file name. Method returns path of the directory created

let path = try? FileOperations.createDirectory(in: .document, direcotryName: "Image")

Create directory form given URL path. Method returns path of the directory created

let documentDirectoryURL = FileOperations.getDocumentDirectoryURL().appendingPathComponent("Images")

let path = try? FileOperations.createDirectory(with: documentDirectoryURL)

Remove directory from document/temp/cache directory with given file name

try? FileOperations.removeDirectory(by: .document, with: "Images")

Remove directory with provided URL

let documentDirectoryURL = FileOperations.getDocumentDirectoryURL().appendingPathComponent("test")

try? FileOperations.removeDirectory(with directoryURL:documentDirectoryURL)

Bundle Related Methods

Readt text file from bundle

 let fileContent = try? FileOperations.getText(form: Bundle.main, fileName: "sample")

Text File Operations

Create text file with file name and directory path

 let filePath =  try? FileOperations.createTextFile(in: .document, fileName: "About", content: "Sample Text")

Create text file form path

 let filePath =  try? FileOperations.createTextFile(with: path, content: "Sample Text")

Delete file with specified path

 let filePath =  try? FileOperations.createTextFile(with: path, content: "Sample Text")

Contributers


You might also like...
WordScramble app for demonstrating loading an external txt file and working with it
WordScramble app for demonstrating loading an external txt file and working with it

WordScramble-v2 WordScramble app for demonstrating loading an external txt file and working with it App for creating anagrams from given 8 letter word

Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings)

Swift .csv parser Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings). Par

Extracts the text from the Docx file

SNDocx Extracts the text from the Docx files and converts them into a valuable object that can be used Example To run the example project, clone the r

A reverse engineering tool to restore stripped symbol table and dump Objective-C class or Swift types for machO file.

A reverse engineering tool to restore stripped symbol table and dump Objective-C class or Swift types for machO file.

A Swift wrapper for URL bookmarks which allow a file to be located regardless of whether it is moved or renamed.

Bookmark A Swift wrapper for URL bookmarks which allow a file to be located regardless of whether it is moved or renamed. This class wraps Swift's URL

Monitor iOS app version easily.

AppVersionMonitor Monitor iOS app version easily. You can get previous version and installation history. Usage To run the example project, clone the r

A way to easily add Cocoapod licenses and App Version to your iOS App using the Settings Bundle
A way to easily add Cocoapod licenses and App Version to your iOS App using the Settings Bundle

EasyAbout Requirements: cocoapods version 1.4.0 or above. Why you should use Well, it is always nice to give credit to the ones who helped you 😃 Bonu

FluxCapacitor makes implementing Flux design pattern easily with protocols and typealias.
FluxCapacitor makes implementing Flux design pattern easily with protocols and typealias.

FluxCapacitor makes implementing Flux design pattern easily with protocols and typealias. Storable protocol Actionable protocol Dispatch

A Swift micro-framework to easily deal with weak references to self inside closures

WeakableSelf Context Closures are one of Swift must-have features, and Swift developers are aware of how tricky they can be when they capture the refe

Owner
Rinto Andrews
iOS Developer
Rinto Andrews
Swift type modelling the success/failure of arbitrary operations.

Result This is a Swift µframework providing Result<Value, Error>. Result<Value, Error> values are either successful (wrapping Value) or failed (wrappi

Antitypical 2.5k Dec 26, 2022
Swift library and command line tool that interacts with the mach-o file format.

MachO-Reader Playground project to learn more about the Mach-O file format. How to run swift run MachO-Reader <path-to-binary> You should see a simila

Gonzalo 5 Jun 25, 2022
Differific is a diffing tool that helps you compare Hashable objects using the Paul Heckel's diffing algorithm

Differific is a diffing tool that helps you compare Hashable objects using the Paul Heckel's diffing algorithm. Creating a chan

Christoffer Winterkvist 127 Jun 3, 2022
Extensions which helps to convert objc-style target/action to swifty closures

ActionClosurable Usage ActionClosurable extends UIControl, UIButton, UIRefreshControl, UIGestureRecognizer and UIBarButtonItem. It helps writing swift

takasek 121 Aug 11, 2022
SuggestionsBox helps you build better a product trough your user suggestions. Written in Swift. 🗳

SuggestionsBox An iOS library to aggregate users feedback about suggestions, features or comments in order to help you build a better product. Swift V

Manuel Escrig 100 Feb 6, 2022
Read iOS 15 privacy insight '.ndjson' file into your human brain.

Insight Read iOS 15 privacy insight '.ndjson' file into your human brain. Written in SwiftUI. Feature Compile records into app summary Relink app info

Lakr Aream 151 Nov 11, 2022
Mac app to change .ipa file app icons and display names

IPAEdit Mac app to change .ipa file app icon, display name, and app version to avoid updates Compatible with macOS 10.11+ Install To install either cl

Ethan Goodhart 23 Dec 28, 2022
.DS_Store file parser/viewer.

.DS_Store file parser/viewer.

JD Gadina 51 Dec 1, 2022
Merges a given number of PDF files into one file using the PDFKit framework

Titanium iOS PDF Merge Merges a given number of PDF files into one file using the PDFKit framework Requirements iOS 11+ Titanium SDK 9+ API's Methods

Hans Knöchel 6 Jan 26, 2022
ALO sync allows you to sync resources form an ALO endpoint to your macOS file system.

ALO sync allows you to sync resources form an ALO endpoint to your macOS file system. Prerequisites macOS 11 No support for search* No suppor

Lawrence Bensaid 2 Jan 22, 2022