πŸ—„ Read files in Swift without Foundation
Switch branches/tags
Nothing to show
Clone or download
Latest commit b5dd99c Apr 29, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Demo Demo project Apr 29, 2018
CFileWrapper.swift Updates methods Apr 29, 2018
README.md typo Apr 29, 2018

README.md

CFileWrapper

A simple wrapper for File handling in Swift without Foundation

You can read files, save files, append to files and list directories

Usage

if let hello = CFileWrapper.read("HelloWorld.txt") {
  print(hello)
}

Another way to read the file is using a completion handler

CFileWrapper.read("HelloWorld.txt") { text in
	guard let text = text else {
		print("Unable to read file")
		return
	}
	print(text)
}

You can also read by line with a delegate

class MyClass: CFileWrapperDelegate {
  func CFileWrapper(read line: String) {
    print(line)
  }
}

let myClass = MyClass()
CFileWrapper.readw("HelloWorld.txt", delegate: myClass)