{"id":13751574,"url":"https://github.com/moflo/SwiftUI-Todo-Redux","last_synced_at":"2025-05-09T18:31:35.346Z","repository":{"id":140075728,"uuid":"193261049","full_name":"moflo/SwiftUI-Todo-Redux","owner":"moflo","description":"SwiftUI Todo app example using a React/Redux monolithic state store with flux like dispatch/reduce actions","archived":false,"fork":false,"pushed_at":"2019-10-13T18:40:48.000Z","size":1987,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-19T03:34:15.165Z","etag":null,"topics":["combine","flux","react","redux","swift","swiftui"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moflo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-22T17:26:20.000Z","updated_at":"2024-03-06T19:21:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"18466f3d-36a0-4724-8353-f6d3a8cf85dc","html_url":"https://github.com/moflo/SwiftUI-Todo-Redux","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moflo%2FSwiftUI-Todo-Redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moflo%2FSwiftUI-Todo-Redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moflo%2FSwiftUI-Todo-Redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moflo%2FSwiftUI-Todo-Redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moflo","download_url":"https://codeload.github.com/moflo/SwiftUI-Todo-Redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253303024,"owners_count":21886873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["combine","flux","react","redux","swift","swiftui"],"created_at":"2024-08-03T09:00:48.940Z","updated_at":"2025-05-09T18:31:33.517Z","avatar_url":"https://github.com/moflo.png","language":"Swift","funding_links":[],"categories":["🌎 by the community"],"sub_categories":[],"readme":"# SwiftUI-Todo-Redux\nSwiftUI Todo Redux app example using a React/Redux monolithic state store with flux like dispatch/reduce actions\n\n\u003cimg src=\"screenshot.png\" width=\"900\" /\u003e\n\n## Background\n\nSwiftUI based app using a centralized, 'monolithic' AppState() which binds to the UI using the `Combine` framework and a `PassthroughSubject` method. This architecture is based on the React/Redux pattern and has a few key benefits:\n\n1. Global app state is maintained in single global struct, `let state = AppState()`\n2. Testing and Previewing of individual views can then be isolated with local test states, eg., a local debug call to `environmentObject(sampleStore)` can be used for UI Previews anywhere in the app\n3. Isolating `Actions` from `State` allows for cleaner synchronous behavior, eg., handle both server based calls and local UI-only actions in the same method or flow\n4. Chnages to state are `Reduced` within a simple state machine method which can be easily tested\n\n\n## File Structure\n\nThe structure of the app follows a simple pattern of MVS: Models, Views and State. Models contain all the relevant state, separated into relevant gropus such as Tasks, Users, Authorization, etc. The `models` directory contains model definitions, as well as codecs and backing store (ie., API Services) for isolated testing of the models and their propoer storage. The `states` directory contains a combination of global app state, the sub-states or `flux` describiing the relevant groups (eg., Task, User), actions which the user initiates (eg., `TaskActions` or `UserActions`) and then trigger asynchronous server-based or synchronous actions. The result of the actions are then reduced (eg., `TaskStateReducer` or `UserStateReducer`) to subsequently modify the global app state.\n\nThe `AppState` structure holds referenes to the group states (ie., Tasks and User lists), as well as acts as a central `dispatch` point for both actions and handling any state updates via the `Combine` framework. \n\nFinally, all UI Views are maintained within their respective hierarchy, with a Home or Root view driving all app navigation.\n\n\n```\n.\n|____AppDelegate.swift\n|____SceneDelegate.swift\n|____views\n| |____HomeView.swift\n|____models\n| |____User.swift\n| |____UserResponse.swift\n| |____Task.swift\n|____states\n| |____AppState.swift\n| |____flux (substate)\n| | |____FluxState.swift\n| | |____UsersState.swift\n| | |____TasksState.swift\n| |____actions\n| | |____Action.swift\n| | |____UserActions.swift\n| | |____TaskActions.swift\n| |____reducers (statemachine)\n| | |____Reducer.swift\n| | |____UserStateReducer.swift\n| | |____TaskStateReducer.swift\n```\n\n\n## Notes\n\n- Mock API testing using [https://www.mocky.io](https://www.mocky.io)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoflo%2FSwiftUI-Todo-Redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoflo%2FSwiftUI-Todo-Redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoflo%2FSwiftUI-Todo-Redux/lists"}