[iOS] TCA x Firestore Friend List App

Yoki
3 min readJan 24, 2024

--

Using TCA and Firestore, I created an application that can manage a person’s information. Here is an overview of the project.

App

https://apps.apple.com/jp/app/id6475261189

Source code is here
https://github.com/yyokii/RelNet

Why

One of the reasons I developed this is to catch up on TCA. I created it as a study because I use it in my work.

The other is because I wanted it.

How do you manage people’s information?

I write in a “memo” application or in “Trello,” but I have not been able to manage it in a coherent manner. It was inconvenient to look at them when I wanted to write them down, and I didn’t have much motivation to write them down.

Apple’s “Contacts” app for iOS is an app that specializes in managing contacts, as the name “Contacts” implies.

  • People you don’t know their contacts (phone numbers or Slack) but see occasionally
  • Information related to that person, such as birthdays, hobbies, favorite foods, etc.

I created the app to organize these information.

What I used

Teck Stacks

  • SwiftUI
  • The Composable Architecture
  • Xcode Cloud
  • Firestore
  • Firebase Auth
  • Firebase Crashlytics
  • Cloud Functions for Firebase

I think these are the most common ones.
I use Firebase for the backend.

Design

  • SF Symbols
  • ChatGPT
  • Clipdrop

The design is simple, as elaborate design would distract from the purpose of the project.

Basic iOS components/colors are used. If an icon is needed, SF Symbols is used.

The app icon was created in DALL-E with ideas from ChatGPT and extended with Clipdrop, with some modifications. It is nice to have a generated AI to quickly create icons that look like that.

TCA

Created with reference to SyncUps in the Examples section of the TCA repository. The README is very comprehensive and covers everything that is likely to be used in common applications.

As described in the README, this project is very helpful because it covers all the common things that are likely to be used in general applications.

This project demonstrates how to build a complex, real world application that deals with many forms of navigation (*e.g.*, sheets, drill-downs, alerts), many side effects (timers, speech recognizer, data persistence), and do so in a way that is testable and modular.

The version of TCA used is currently 1.6.0.
The Reducer macro was introduced in version 1.4, and together with the updates in 1.5, it is simpler to access by keypath than ever before.

For example, the following changes are possible

Scope

-       Scope(state: \.login, action: /Action.login) {
+ Scope(state: \.login, action: \.login) {
Login()
}

ifLet

-       .ifLet(\.$alert, action: /Action.alert)
+ .ifLet(\.$alert, action: \.alert)

navigationDestination

       .navigationDestination(
- store: store.scope(state: \.$destination, action: Main.Action.destination),
- state: /Main.Destination.State.personDetail,
- action: Main.Destination.Action.personDetail
+ store: store.scope(state: \.$destination.personDetail, action: \.destination.personDetail)
) {
PersonDetailView(store: $0)
}

Also, TaskResult is Deprecated.
More info here: Moving off of TaskResult

TCA and Firestore

Dependencies are created for Firestore data manipulation and Firebase Auth authentication.

Dependencies are created for data manipulation in Firestore and authentication process in Firebase Auth.

Return AsyncThrowingStream for those that listen to data.

Conclusion

I am planning to add AI features in the future.

I hope this will be helpful!

https://apps.apple.com/jp/app/id6475261189

https://github.com/yyokii/RelNet

--

--