Member-only story
Diving into SwiftUI has been an exciting adventure for me. As someone new to iOS development, I decided to create a simple journal app to apply what I’ve been learning. This project not only helped me understand the basics of SwiftUI but also gave me a sense of accomplishment seeing my ideas come to life. Here’s a brief overview of my experience building the app.
The Idea
I wanted to create a straightforward journal app where I could add, view, and edit entries. The main components I focused on were:
- ContentView: Displays a list of journal entries.
- JournalViewModel: Manages the data and logic.
- JournalEntry: Represents each journal entry.
- JournalDetailView: Allows viewing and editing individual entries.
Building ContentView
ContentView is the main screen showing all journal entries. I used a NavigationView
with a List
to display each entry. Adding new entries was as simple as tapping a button that appends a new item to the list.
struct ContentView: View {
@EnvironmentObject var journalViewModel: JournalViewModel
var body: some View {
NavigationView {
List {
ForEach($journalViewModel.entries) {…