Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
VFK committed Feb 1, 2017
1 parent 513888e commit 7f7eac4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ let decodedString = String(data: result, encoding: .utf8)
```

> ⚠️ Be careful with force unwrapping, everything on this page provided just as an example!

#### Example of decoding torrent file
```swift
import Bencode
Expand All @@ -35,20 +36,24 @@ do {
print(announce)
}

} catch BencodeDecodeError.invalidFormat {}
} catch BencodeDecodeError.invalidFormat {

} catch {

}
```

## Installation
## Swift Package Manager
### Swift Package Manager

```swift
import PackageDescription

let package = Package(
name: "YOUR_PROJECT_NAME",
targets: [],
<...>
dependencies: [
.Package(url: "https://github.com/VFK/SwiftyBencode.git", majorVersion: 0, minor: 1),
]
<...>
)
```
8 changes: 4 additions & 4 deletions Sources/Bencode.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Foundation

public class Bencode {

static func decode(data: Data) throws -> Any {
public final class Bencode {
public static func decode(data: Data) throws -> Any {
let decoder = Decoder(with: data)
return try decoder.decode()
}

}
2 changes: 1 addition & 1 deletion Sources/Decoder.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

enum BencodeDecodeError: Error {
public enum BencodeDecodeError: Error {
case invalidFormat
}

Expand Down

0 comments on commit 7f7eac4

Please sign in to comment.