Skip to content

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KISS SwiftUI Views showcase

Welcome to the demonstration of simple, universal and generic SwiftUI views.

Main Features

  • Pure SwiftUI
  • A simple, generic AppErrorView linkable with ViewModels handling different app error / business cases.
  • A badly-written, multipurpose BadErrorView added for comparison
  • Navigation based on Router and NavigationStack
  • Sample Unit Tests coverage

Integration

Requirements

  • iOS 16.0

Running the app

  • Clone the repo.
  • Open KISS Views.xcodeproj file.
  • Run KISS Views scheme.

App content

Universal views

The app showcases a universal, reusable and generic ErrorView to visualise various app errors:

  • No network connection
  • Backend unresponsive
  • Outdated application
  • Security issues detected

Each of the cases above has a dedicated View Model responsible for providing view configuration and handling user feedback (e.g. tapping a button): NoNetworkErrorViewModel, AppUpdateRequiredErrorViewModel, etc.

Badly written, "smart" view (for reference)

The app contains also badly written, "smart" BadErrorView (with bound BadErrorViewModel).
The view also visualises different app errors, but the way is implemented is complicated and not sustainable throughout the life of the project.
The purpose of this code is to visualise how quickly a rather simple view can grow (in size and complexity) when new responsibilities are added to it.
Please refer to the commit history between fde934ed002e6a23844c27f9a77ddf61d27acf00 and 5dafddd3763c2dba7208761d1c71d96cf1130cb7.

Navigation

Each of the showcased app errors can be displayed as:

  • a view in a navigation stack
  • a popup in a sheet

To do that, and also allow views to pop / dismiss themselves from code, the app provides NavigationRouter.
The router is bound with the HomeView navigation stack.

Project maintainer

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

License

This project is licensed under the MIT License. More info

About

A project demonstrating how we can implement simple, reusable, and testable SwiftUI Views.

Topics

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages