WriteFreely Mac/iOS App: A Progress Update
Tags: swift, swiftui, writefreely, showdev
Published: 2020-08-28 20:21:58

It feels like it was just yesterday when I [shared some initial screenshots](https://dev.to/angelostavrow/the-promise-vs-reality-of-swiftui-multiplatform-4pf9) of the WriteFreely app prototype running on iOS and Mac.

(In fact, it was almost four weeks ago.)

I've been making a lot of progress on this, and I'd love to show you where the app is today.

---

## Pictures, Worthy of A Thousand Words

How about starting with a few screenshots? This is subject to change, but it's likely not going to change _much_.

!["iPhones and iPad showing various screenshots of the WriteFreely app"](https://i.snap.as/HLSuQGs.png)

Above, you'll see the current version of the app, running on iPhone and iPad.

The first iPhone screenshot shows the list of posts in my _Testing_ collection, a private blog which I'm using for —you guessed it— testing. Tapping on the **<&nbsp;Collections** navigation link at the top-left will let you choose another collection; other buttons above and below the list let you create a new local post, refresh from the server, and access settings and preferences.

Tap on any post in the list, and you'll be taken to the app's editor, as shown in the second iPhone screenshot. Any edits you make here are saved locally, and if you like, you can publish it to your WriteFreely instance.

The iPad screenshot shows the same navigation hierarchy, and like the iPhone version, it works just as you'd expect on iPadOS — a sidebar to choose the collection, a table to choose a post in the collection, and the selected post in the editor.

!["The WriteFreely app running on the Mac"](https://i.snap.as/JlLaWv2.png)

Here's the app running on the Mac — the same kind of navigation, as suited to the Mac. You can more clearly see how the app's editor departs a bit from the web editor, too, with a defined area for the post's title (if you choose to add one), and another text area below for your post's content.

!["The WriteFreely app in 'dark mode' on iPhone and Mac"](https://i.snap.as/wDaM902.png)

Oh, and of course, "dark mode" looks great. You can choose to have the app display a light scheme, a dark scheme, or to simply follow your system's setting.

## Will It Post?

The basic flow of the app right now is straightforward. On launch, you're not logged in to your account, but you can create new posts that only live on your device. These posts currently show a "draft" badge, though that's going to [get a less-confusing name](https://github.com/writeas/writefreely-swiftui-multiplatform/issues/36).

As of the time of writing, the app doesn't yet store anything on disk except for your colour-scheme preference and your logged-in state, so if you quit the app —or if it crashes, which at this stage, it does every so often— you lose whatever you had. So, naturally, [adding local storage](https://github.com/writeas/writefreely-swiftui-multiplatform/issues/16) is a priority.

To guard against that, you can log in to your WriteFreely account to pull in your collections and posts from the server. Those posts show up as "published", and you can edit them, at which point the "published" badge changes to "edited"; when you're done, you can push those changes to the server, which has the "edited" badge go back to "published".

Similarly, your local posts (the ones with the "draft" badge) can be published to your WriteFreely Drafts —see why it needs to be renamed?— at which point the badge changes to "published".

Tapping the reload button in the post list will fetch new content from the server. Because data loss is unacceptable, the app checks to see what the last-updated timestamps are between the local and remote copies of a post, and then applies the following rules:

1. If the local copy is unchanged and the remote copy is newer, replace the local copy with the remote copy;
2. If the local copy has unpublished changes and the remote copy is older, discard the remote copy; and finally,
3. If the local copy has unpublished changes and the remote copy is newer, notify the user and prompt them to make a decision:

!["A portion of a screenshot warning that a newer copy of the post exists on the server."](https://i.snap.as/XG1RChc.png)

This last bit is still under construction. Once the work is complete, you'll be able to choose which copy to keep — and of course, you'll be prompted to confirm your choice, since this will replace the local copy with the remote copy, or vice-versa.

If you log out of your account, everything is purged from the device — your collection list, your local _and_ published posts, your logged in state, everything.

## Still To Do

The easiest thing would be just link to the [list of GitHub issues for the 1.0 beta](https://github.com/writeas/writefreely-swiftui-multiplatform/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0.0-beta) — but I'm going to discuss some of the more pertinent things here, to save you a click.

Of course, saving content to your device is going to be important. There are also a couple of bugs that need fixing because they hang the app or make buttons unresponsive, so that's no good. But mostly, these to-do items fix get the user experience close to that of the WriteFreely web app.

For example — right now the app launches and drops you in the post list. It should instead drop you in the editor with a new (or recent) local post. Those local posts default to Drafts (i.e., not part of a collection), but you should be able to choose a collection for them.

Departing from other WriteFreely clients, there's an "All Posts" list which, as the name implies, shows all posts across your Drafts and your collections, all together. It doesn't, however, tell you which post belongs to which collection (neither does the editor), so that needs fixing.

And there are a few things that haven't been added as issues just yet —and maybe they won't make it into the first release— that include, off the top of my head:

- Sorting the list (by created date or last-updated date, ascending or descending)
- Changing the logout behaviour to keep only your local posts, and adding another setting to delete everything (the current logout behaviour)
- Full-text search
- Keyboard shortcuts

We're getting closer and closer to a public beta, so that's exciting! And if you want to [contribute](https://write.as/angelo/contributing-to-the-writefreely-swiftui-client), please don't hesitate to [reach out in this forum topic](https://discuss.write.as/t/writefreely-swiftui-multiplatform-app-mac-iphone-ipad/1664)!