Skip to content

Commit

Permalink
[Internal] documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
reddavis committed Jul 23, 2021
1 parent 0023964 commit 2954982
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Kyu is a stupidly simple, persistant, queue system.

## Requirements

- iOS 13.0+
- macOS 11.0+
- iOS 15.0+
- macOS 12.0+

## Installation

### Swift Package Manager

```
dependencies: [
.package(url: "https://github.com/reddavis/Kyu", from: "2.0.0")
.package(url: "https://github.com/reddavis/Kyu", from: "3.0.0-beta.1")
]
```
## Usage
Expand All @@ -29,7 +29,6 @@ A simple "Append new line to end of file" job could look something like:
```
final class AppendNewLineJob: Job
{
// Internal
let id: UUID
var maximumNumberOfRetries: Int { 5 }
var numberOfRetries = 0
Expand All @@ -49,21 +48,12 @@ final class AppendNewLineJob: Job
// MARK: Job
func execute(onComplete: @escaping (Result<Void, Error>) -> Void)
func execute() async throws
{
do
{
let fileHandle = try FileHandle(forWritingTo: self.fileURL)
try fileHandle.seekToEnd()
fileHandle.write("\(self.string)\n".data(using: .utf8)!)
fileHandle.closeFile()
onComplete(.success(Void()))
}
catch
{
onComplete(.failure(error))
}
let fileHandle = try FileHandle(forWritingTo: self.fileURL)
try fileHandle.seekToEnd()
fileHandle.write("\(self.string)\n".data(using: .utf8)!)
fileHandle.closeFile()
}
}
```
Expand All @@ -76,8 +66,11 @@ The Kyu manages and executes jobs. It take a `URL` parameter, which is where it
let url = URL(string: ...)!
self.kyu = try Kyu<AppendNewLineJob>(url: url)
let job = AppendNewLineJob(fileURL: fileURL, string: "a string to append")
try kyu.add(job: job)
let job = AppendNewLineJob(
fileURL: fileURL,
string: "a string to append"
)
try await kyu.add(job: job)
```

## License
Expand Down

0 comments on commit 2954982

Please sign in to comment.