Go to file
Angelo Stavrow e1335edb12
Weakly capture self to avoid leaks (#36)
2023-02-12 11:11:13 -05:00
.github/workflows Create githubActions.yml file 2021-05-25 16:25:14 -04:00
.swiftpm/xcode/package.xcworkspace Initial Commit 2020-06-18 15:57:21 -04:00
Sources/WriteFreely Weakly capture self to avoid leaks (#36) 2023-02-12 11:11:13 -05:00
Tests Add boilerplate test files to package 2021-05-25 16:22:55 -04:00
WFPackagePlayground.xcworkspace/xcshareddata Rename WriteFreelyClient to WFClient 2020-08-17 10:47:30 -04:00
docs Add the correct base URL for GitHub Pages 2021-05-27 16:40:42 -04:00
.arena-sample.swift Update sample code 2021-06-10 17:16:42 -04:00
.gitignore Do not include .build folder in repo 2021-05-20 16:26:57 -04:00
CODE_OF_CONDUCT.md Adds code of conduct documentation 2020-06-30 11:49:29 -04:00
CONTRIBUTING.md Update contributing doc to point to code of conduct 2020-06-30 11:54:06 -04:00
LICENSE.md Release alpha version 2020-06-23 16:54:36 -04:00
Package.swift Extend date decoding strategy for possible fractional seconds (#35) 2022-10-05 09:23:25 -04:00
README.md Update SwiftDoc command with correct parameters 2021-05-27 16:49:17 -04:00

README.md

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:

$ swift doc generate Sources --module-name WriteFreely --format html --output ./docs --base-url https://writefreely.github.io/writefreely-swift/

Installing

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

Running the tests

Run the tests from the command line:

$ swift build
$ swift test

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:

guard let instanceURL = URL(string: "https://your.writefreely.host/") else { fatalError() }
let client = WFClient(for: instanceURL)
client.login(username: "username", password: "password", completion: { result in
    switch(result) {
    case .success():
        // Do something with the returned WFUser
    case .failure():
        // Do something with the returned WFError
    }
})

See the API documentation for more details. Xcode-specific documentation is also available here.

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.