WriteFreely Documentation Beta

Structure WFPost

public struct WFPost 
WFPost WFPost Decodable Decodable WFPost->Decodable

Conforms To

Decodable

Initializers

init(body:​title:​appearance:​language:​rtl:​created​Date:​)

public init(
        body: String,
        title: String? = nil,
        appearance: String? = nil,
        language: String? = nil,
        rtl: Bool? = nil,
        createdDate: Date? = nil
    ) 

Creates a basic WFPost object.

This initializer creates a bare-minimum WFPost object for sending to the server; use the decoder-based initializer to populate its other properties from the server response.

Only the body parameter is required. If other properties are not provided, they will be generated by the server.

Parameters

body String

The body text for the post.

title String?

The title for the post.

appearance String?

The appearance for the post; one of sans, serif/norm, wrap, mono, or code. Defaults to serif.

language String?

An ISO 639-1 language code.

rtl Bool?

Set to true to show content right-to-left.

created​Date Date?

The published date for the post.

init(from:​)

public init(from decoder: Decoder) throws 

Creates a WFPost object from the server response.

Primarily used by the WFClient to create a WFPost object from the JSON returned by the server.

Parameters

decoder 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

post​Id

public var postId: String?

slug

public var slug: String?

appearance

public var appearance: String?

language

public var language: String?

rtl

public var rtl: Bool?

created​Date

public var createdDate: Date?

updated​Date

public var updatedDate: Date?

title

public var title: String?

body

public var body: String

tags

public var tags: [String]?

views

public var views: Int?

collection​Alias

public var collectionAlias: String?