Superhero-composable-watch-example - A superhero themed experiment using the swift composable architecture on a SwiftUI/Combine iOS app and Watch extension

Overview

Superhero Composable Watch Example

Calling all superhero and Apple Watch enthusiast, I have an experimental project for you ๐Ÿ˜ฌ ! This experimental project, created in SwiftUI and Combine, plays with the composable architecture (TCA) aka swift composable architecture.

Swift Composable Architecture is an architecture framework designed with state management, composition, and testing in mind. With the rise of the SwiftUI and Combine duo came uncertainity with how to cleanly design apps in this new declarative world. SCA/TCA attempts to rangle the tumbleweeds and bring some order to the wild wild SwiftUI/Combine west.

Index

  • Intro
  • Setup
  • Current
  • Next Steps
  • Additional Resources
  • Current Thoughts

Intro

In this experiment I built SuperheroFoundation implemented with the swift composable architecture and then integrated the SCA views in an iOS app and WatchKit extension. On the networking layer, a call is made to a Superhero API which returns a superhero based on a character id, range: 1...731

The app populates with a sample row. Clicking on the + button on the ios app or another one on the watch app eventually triggers the Home.Effect performing the network call to retrieve another superhero.

Setup

The Superhero API requires an access token. To create a token head over to the Superhero API and login with your Facebook.

With your token on standby and the Xcode project open, head to the scheme you'd like to run [iOS target or Watch target] and click Edit Scheme....

On the left pane of the Edit Scheme... menu, click the Run tab and on the main editor under Arguments in the Environemnt Variables section add a new key/value. The key should be called ACCESS_TOKEN and the value is the token previously obtained and put on standy.

Okay, that's all. You're ready to soar with the heros ๐Ÿฆธ๐Ÿพโ€โ™€๏ธ

Current

Currently the app has two tabs on the ios target and three tabs on the watch extension.

  • Click on the + we get a new hero added to the list
  • Click on the ๐Ÿ” , we'll see a console log

There is a view update bug ( ๐Ÿ› ew) where the state updates - you'll notice the updated view model in the console - however the view itself does not update ๐Ÿค” .

Next Steps

  1. Deduce the source of the view non-update bug
  2. Pull the SuperheroFoundation into a package
  3. Explore: combining multiple states within a single non-base reducer
  4. Prettify the UI with all of the โœจ things

Additional Resources

Current Thoughts

< 2 weeks: The Store is a magical container that glues everything together. The redux architecture inspired reducer is gratifying. TCA is a nice addition to the fast paced and convenient SwiftUI + Combine prototyping flow. For MVPs, and early stage projects, TCA allows developers to focus on the project features at a high level.

When it comes to project long term maintainability, TCA's magic starts to wear off. To have a third party package have so much architectural control over an application creates long term dependence that will be harder to change the longer time passes. Apple is already known to release app breaking changes with new updates ๐Ÿ™ƒ , to not be able to go in and fix what needs to be fixed yourself in lieu of waiting for the package to be updated, yikes.

In addition, the underlying principles highlighted with this approach in the SwiftUI/Combine ecosystem, arguably the most valuable aspect of the package, can be custom implemented. In this way projects can have peek flexibility as then vendors can be swapped out as needed on a granualar level.

TCA/SCA as a package will still be used for experimentations only.

You might also like...
content for Using Combine - notes on learning Combine with UIKit and SwiftUI
content for Using Combine - notes on learning Combine with UIKit and SwiftUI

SwiftUI-Notes A collection of notes, project pieces, playgrounds and ideas on learning and using SwiftUI and Combine. Changes, corrections, and feedba

A library that provides undo semantics for the Composable Architecture with optional bridging tofUndoManager.

Swift Composable Undo A library that provides undo semantics for the Composable Architecture with optional bridging with UndoManager. Motivation It is

Pointfree's Composable Architecture Relay

RelayStore Pointfree's Composable Architecture Relay to hook into Actions sent to the Store from outside. Read more at Observe actions in The Composab

An iOS template project using SwiftUI, Combine and MVVM-C software architecture
An iOS template project using SwiftUI, Combine and MVVM-C software architecture

SwiftUI-MVVM-C A template project that uses SwiftUI for UI, Combine for event handling, MVVM-C for software architecture. I have done some small proje

This is an example project of SwiftUI and Combine using GitHub API.
This is an example project of SwiftUI and Combine using GitHub API.

SwiftUI-Combine-Example This is an example project of SwiftUI and Combine using GitHub GET /search/users API. ๐Ÿ“‹ Requirements Swift5.1 Beta Xcode11.0

This is an example project of SwiftUI and Combine using GitHub API.
This is an example project of SwiftUI and Combine using GitHub API.

SwiftUI-Combine-Example This is an example project of SwiftUI and Combine using GitHub GET /search/users API. ๐Ÿ“‹ Requirements Swift5.1 Beta Xcode11.0

A demo app to showcase testable, modern iOS development with SwiftUI and Combine on MVVM-C architecture.

Coinz_App_iOS A demo app to showcase testable, modern iOS development with SwiftUI and Combine on MVVM-C architecture. Tech Stack: Swift, SwiftUI, Com

Porting the example app from our Advanced iOS App Architecture book from UIKit to SwiftUI.

SwiftUI example app: Koober We're porting the example app from our Advanced iOS App Architecture book from UIKit to SwiftUI and we are sharing the cod

๐Ÿ–ผ Gallery App for Harvest (Elm Architecture + Optics) + SwiftUI + Combine.
๐Ÿ–ผ Gallery App for Harvest (Elm Architecture + Optics) + SwiftUI + Combine.

๐Ÿ–ผ Harvest-SwiftUI-Gallery Gallery App for Harvest (Elm Architecture + Optics) + SwiftUI + Combine. Examples Todo List Stopwatch GitHub Search TimeTra

Owner
Jessica
๐Ÿ“ฑiOS + Backend + XR Engineer ๐Ÿฅ” Creating apps/experiences ๐Ÿค– Founder @bornbklynstudio
Jessica
Best architecture for SwiftUI + CombineBest architecture for SwiftUI + Combine

Best architecture for SwiftUI + Combine The content of the presentation: First of the proposed architectures - MVP + C Second of the proposed architec

Kyrylo Triskalo 3 Sep 1, 2022
harry potter themed social network similar to IG

Potter Pics PotterPics is a Harry Potter themed social network similar to Instagram. Walkthrough Home, Main Feed, Profile Library Post, Search, Camera

suraya shivji 150 Dec 1, 2022
Learn how to structure your iOS App with declarative state changes using Point-Free's The Composable Architecture (TCA) library.

Learn how to structure your iOS App with declarative state changes using Point-Free's The Composable Architecture (TCA) library.

Tiago Henriques 0 Oct 2, 2022
ScrumdingerTCA - Appleโ€™s tutorial app recreated using The Composable Architecture

ScrumdingerTCA Appleโ€™s tutorial app recreated using The Composable Architecture

Pat Brown 9 Nov 29, 2022
Open source game built in SwiftUI and the Composable Architecture.

isowords This repo contains the full source code for isowords, an iOS word search game played on a vanishing cube. Connect touching letters to form wo

Point-Free 2.1k Jan 1, 2023
Another experiment with SwiftUI 4.0

SleepStories Tentang Project Di Figma Communities ada banyak UI Design yang menarik apabila bisa dibuat versi riil aplikasinya khususnya aplikasi iOS.

Hidayat Abisena 5 Dec 24, 2022
An experiment to use Firebase and React Native to build a wwdc.family app

wwdc.family This is an experiment to use Firebase and React Native to build a wwdc.family app. Don't use that source code as reference - I have no pri

WWDC Family 190 Feb 9, 2022
Github repo search with using mvvm-c and clean architecture and using combine swift

GitSearchWithMVVM-C-CleanArchitecture Github repo search with using mvvm-c and clean architecture and using combine swift. Content Overview How To Run

Muhammad Qasim Majeed 1 Mar 16, 2022
A library to derive and compose Environment's in The Composable Architecture.

ComposableEnvironment This library brings an API similar to SwiftUI's Environment to derive and compose Environment's in The Composable Architecture.

Thomas Grapperon 129 Dec 14, 2022
An example APOD app with SwiftUI and Combine using NASA API

SwiftUI-APOD An example Astronomy Picture of the Day(APOD) application using SwiftUI and Combine under iOS 13 Requirement Xcode 11 macOS 10.15 Catalin

Liang Yi 22 Oct 16, 2022