Skip to content

Commit

Permalink
Merge pull request #23 from Ast3r10n/feature/public-configuration
Browse files Browse the repository at this point in the history
Make Configuration public, allow computed properties
  • Loading branch information
Ast3r10n authored Sep 11, 2020
2 parents 3f2bd03 + 9ce12a6 commit 9936732
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ https://github.com/Ast3r10n/swiftquests
### Cocoapods

Add `SwiftQuests` to your Podfile:
```
```ruby
pod 'SwiftQuests'
```

Expand All @@ -29,7 +29,7 @@ Once initialised, a `Request` is (for the most part) immutable. Its task will on

To perform a basic `Request`, initialise one:

```
```swift
do {
let request = try Request(.get,
atPath: "/user")
Expand All @@ -39,7 +39,7 @@ do {
```
You then call the `perform` method to launch its associated task.

```
```swift
do {
try request.perform { result in
// Response implementation
Expand All @@ -55,7 +55,7 @@ do {

Here's an example `Request` to get a `Decodable` `User` object from the `/user` endpoint.

```
```swift
do {
try Request(.get,
atPath: "/user")
Expand Down
12 changes: 6 additions & 6 deletions Sources/SwiftQuests/DefaultRequestConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ public protocol RequestConfiguration {
/// The default Request headers.
///
/// Any headers passed to specific `Requests` would be appended to these.
var defaultHeaders: [String: String] { get set }
var defaultHeaders: [String: String] { get }

/// The Request protocol.
var requestProtocol: String { get set }
var requestProtocol: String { get }

/// The default base URL (not including protocol).
var baseURL: String { get set }
var baseURL: String { get }

/// The default port.
var port: Int { get set }
var port: Int { get }

/// The server's authentication realm.
var authenticationRealm: String { get set }
var authenticationRealm: String { get }

/// The default authentication method to use with Requests.
var authenticationMethod: String { get set }
var authenticationMethod: String { get }
}

public extension RequestConfiguration {
Expand Down
3 changes: 1 addition & 2 deletions Sources/SwiftQuests/RequestConfigurationHolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ public class RequestConfigurationHolder {
/// The holder singleton instance.
public static var shared = RequestConfigurationHolder()

// MARK: - Internal Properties
/// The configuration assigned to the holder.
var configuration: RequestConfiguration
public internal(set) var configuration: RequestConfiguration

// MARK: - Internal Methods
/// Creates a holder object, assigning the specified configuration.
Expand Down

0 comments on commit 9936732

Please sign in to comment.