WriteFreely

0.3.2

A Swift package wrapping the WriteFreely / Write.as API
writefreely/writefreely-swift

What's New

v0.3.2

2021-05-25T20:49:50Z

This is a minor release that fixes a build error on Xcode 12.4 and reinstates the boilerplate testing files that are generated by Xcode, in preparation for adding tests to the project.

WriteFreely

A Swift package that wraps the WriteFreely API, for use in your Swift projects.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See Deployment for notes on how to add the library to your app.

Prerequisites

You'll need Xcode 11.5 / Swift 5.2 installed along with the command line tools to work on this package.

Additionally, documentation is generated by SwiftDoc. After making any changes to the package's public API, you'll need to regenerate the docs; to do so, run the following commands in the terminal from the root directory of the package:

$ rm -rf .build/documentation
$ swift doc generate Sources --module-name WriteFreely

Installing

  1. Clone this repository.
  2. There is no step two.

Running the tests

TK

Deployment

Follow the instructions in this Apple Developer document to add the WriteFreely Swift package to your app.

Once you've done that, just import the library into whichever files should consume it:

@import Foundation  // Or UIKit, Cocoa, &cet.
@import WriteFreely

// The rest of the Swift file goes here

Use public methods on the WFClient to send and receive data from the server. The methods leverage completion blocks and the Result type, so you'd call them like so:

func loginHandler(result: (Result<WFUser, Error>)) {
    do {
        let user = try result.get()
        print("Hello, \(user.username)!")
    } catch {
        print(error)
    }
}


guard let instanceURL = URL(string: "https://your.writefreely.host/") else { fatalError() }
let client = WFClient(for: instanceURL)
client.login(username: "username", password: "password", completion: loginHandler)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Need help getting started? Find out more about the project's office hours.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the BSD 3-Clause License - see the LICENSE.md file for details.

Description

  • Swift Tools 5.2.0

Dependencies

  • None
Last updated: Thu Jun 10 2021 20:47:01 GMT-0500 (GMT-05:00)