Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 886 Bytes

README.md

File metadata and controls

41 lines (32 loc) · 886 Bytes

FileLiner

This Swift package helps you read a file line by line.

Installation

Swift Package Manager

.package(url: "https://github.com/ethemozcan/FileLiner.git", .upToNextMinor(from: "1.0.0"))

Cococapods

target 'YourApp' do
  pod 'FileLiner', '~> 1.0'
end

Usage

        import FileLiner

        do {
            let path = Bundle.main.path(forResource: "TestFile", ofType: "csv")
            let fileLiner = try FileLiner(path: path!)

            while fileLiner.hasLinesToRead {
                print(fileLiner.readLine()!)
            }
        } catch FileLinerError.fileNotExist {
             // Handle Error
        } catch FileLinerError.invalidDelimiter {
            // Handle Error
        } catch FileLinerError.invalidChunk {
            // Handle Error
        } catch {
            // Handle Error
        }