writefreely-swift/docs/WFCollection.md

98 lines
1.5 KiB
Markdown

# WFCollection
``` swift
public struct WFCollection
```
## Inheritance
`Decodable`
## Initializers
### `init(title:alias:)`
Creates a basic `WFCollection` object.
``` swift
public init(title: String, alias: String?)
```
This initializer creates a bare-minimum `WFCollection` object for sending to the server; use the decoder-based
initializer to populate its other properties from the server response.
If no `alias` parameter is provided, one will be generated by the server.
#### Parameters
- title: The title to give the Collection.
- alias: The alias for the Collection.
### `init(from:)`
Creates a `WFCollection` object from the server response.
``` swift
public init(from decoder: Decoder) throws
```
Primarily used by the `WFClient` to create a `WFCollection` object from the JSON returned by the server.
#### Parameters
- decoder: The decoder to use for translating the server response to a Swift object.
#### Throws
Error thrown by the `try` attempt when decoding any given property.
## Properties
### `alias`
``` swift
public var alias: String?
```
### `title`
``` swift
public var title: String
```
### `description`
``` swift
public var description: String?
```
### `styleSheet`
``` swift
public var styleSheet: String?
```
### `isPublic`
``` swift
public var isPublic: Bool?
```
### `views`
``` swift
public var views: Int?
```
### `email`
``` swift
public var email: String?
```
### `url`
``` swift
public var url: String?
```