Skip to content
A demo application using unidirectional data flow with SwiftUI and WeeDux
Swift
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
QOTD.xcodeproj fix: update scheme name Aug 15, 2019
QOTD test: Add example Command test Aug 14, 2019
QOTDTests test: Add example Command test Aug 14, 2019
.gitignore chore: Ignore VSCode artifacts Aug 9, 2019
.swiftformat chore: move .swiftformat to root Aug 11, 2019
LICENSE chore: initial project setup Aug 9, 2019
README.md doc: Add buildkite badge Aug 15, 2019
ipad-screenshot.png doc: Update readme Aug 10, 2019

README.md

QOTD

Screenshot

Build status

An example app using SwiftUI, SwifTEA and SwifTEAUI.

Overview

SwiftUI gives us the opportunity to exploit unidirectional data flow within iOS and related platforms. The QOTD application shows how to use WeeDux to drive SwiftUI and explores the ergonomics of the solution.

QOTD uses the free API from theysaidso.com. The free version places significant access limitations (10 calls an hour) without a key. While this would not be ideal for a production application it great in our purposes as it allows us to explore error handing and retries.

Examples

  • Creating a Program and Model with persistence support
  • Composing Messages, Commands and Environments
  • Using Messages to drive View updates
  • Service access via Commands
  • Remote images with stateless components
  • Displaying errors when a resource loading fails
  • Cancelling work when a View disappears
  • Control interactions
  • Unit Test example for MessageHandlers
  • Unit Test example for Commands
  • Unit Test example for Views

⚠️ At the time of writing a bug is SwiftUI is preventing the onDisappear method being called. This prevents the various cancel messages from being fired.

If there are any other examples you'd like to see, please let me know.

Slides

The slides from my talk at CocoaHeads Melbourne can be found at SwifTEA UI - Unidirectional dataflow with SwiftUI and WeeDux

Licence

MIT License

Copyright (c) 2019 Kevin O'Neill

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You can’t perform that action at this time.