💡 Inspiration

I wouldn't call myself a journaling enthusiast, but I have always been easily swayed by my emotions. I wanted to find a way to record these feelings to help myself and the friends around me. However, trying to write in a standard notes app or a physical notebook often felt a bit... lonely. It felt like shouting into a void with no echo.

I wanted to create a safe space where our feelings are actually "heard." I didn't want another productivity tool or a cold mood tracker with charts and graphs. I wanted something "useless" but healing.

This inspired me to build HeartZoo: a space where you are never writing alone. Instead of an empty screen, you have virtual animal companions who listen to your worries and write warm, comforting letters back to you.

⚙️ How I built it

HeartZoo is a native iOS application built with SwiftUI, powered by the intelligence of Google Gemini.

1. The Frontend (iOS)

  • SwiftUI & Animations: I focused heavily on "tactile" interactions. The core experience revolves around the ritual of receiving a letter. I used SwiftUI to build complex animations for the envelope arriving and the letter unfolding, making the digital experience feel physical and cozy.
  • Local Data: User journals are stored securely on the device using SwiftData to ensure privacy.

2. The Brain (Google Gemini)

The core magic lies in how the animals "understand" and "reply." I integrated the Gemini API to power the animal agents.

  • Persona Engineering: I designed distinct system prompts for different animals. For example, the Bear is prompted to be warm, slow, and protective, while the Cat is prompted to be slightly aloof but secretly caring.
  • Contextual Understanding: I utilize Gemini's context window to analyze the user's current mood entry. The model extracts the emotional sentiment and generates a reply that validates the user's feelings without being judgmental.

🧩 Challenges I faced

  • Prompt Engineering for Empathy: Initially, the AI sounded too robotic or overly advice-giving ("Here are 3 tips for your anxiety..."). It was a challenge to iterate on the prompts to make Gemini sound more like a friend and less like a therapist. I learned to instruct the model to focus on "listening and validating" rather than "solving," and to adopt the unique speech patterns of each animal character.

📚 What I learned

  • AI as an Emotional Anchor: I learned that LLMs like Gemini are surprisingly good at detecting subtle emotional nuances. They can pick up on loneliness even when the user writes about something mundane.
  • The Power of "Agentic" Design: By giving the AI a face (a bear) and a personality, users forgive the AI's imperfections and form a real emotional bond with the character.
  • SwiftUI + AI Integration: I gained deep experience in integrating AI responses into a native iOS environment to create a seamless user experience.

🚀 What's next for HeartZoo

I plan to implement Gemini's Multimodal capabilities. I want users to be able to snap a photo of their rainy window or their comfort food, and have the animals recognize the image and mention it in their letters!

Built With

  • google-gemini-api
  • ios
  • swift
  • swiftdata
  • swiftui
Share this project:

Updates