Building a to-do list app with SwiftUI and Firebase - Pt 1

Firebase · 48K views · 2020 · 53:56

Open on YouTube

Software architecture & designWeb developmentSoftware (other)tutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they are following when asking SwiftUI, Combine and Firestore MVVM questions about the example app's code.

Recommended by 0 people across 0 different months, 2020 to 2021.

What it is

A 54-minute Firebase Semi-live episode in which Firebase Developer Advocate Peter Friese builds a to-do app in SwiftUI backed by Firebase. It covers the data model, list view, view model architecture and Combine usage, ending with a recap.

What people said

Cites user14518353 · 2020-11 · Stack Overflow · on “Cannot find 'taskCellVM' in scope”

I'm following a tutorial to make a reminders app in swiftui. I'm pretty new to more complex apps in swiftui and there were these errors in the debugger. What do they mean and how I can solve them. If it helps, the tutorial that I'm watching is this: [this video] Thank you in advance. 1)TaskListView.swift:15:25: error: failed to produce diagnostic for expression; please file a bug report var body: some View { 2) TaskListView.swift:20:45: error: cannot find 'taskCellVM' in scope in TaskCell(taskCellVM: taskCellVM) ^~~~~~~~~~ TaskListView.swift import SwiftUI struct TaskListView: View { @ObservedObject var taskListVM = TaskListViewModel() let tasks = testDataTasks var body: some View { NavigationVie

Cites Michael Cox · 2021-01 · Stack Overflow · on “Need keypath syntax for use in assign(to:_) in SwiftUI”

I'm new to SwiftUI and have been following along with @ peter-friese [LINK] 's example SwiftUI/Firebase app [this video] . My example app works perfectly, but am now trying to modify slightly but am unable to get the correct keypath syntax of in the assign/map in order to set a property. Relevantly (and slightly simplified), there is a struct for the data model: struct Task: Codable, Identifiable { var title: String var status: Bool var flag: Bool } and a class for a view model: class TaskCellViewModel { @Published var task: Task var iconName:String = "" } In this tutorial a map/assign is used within the TaskCellViewModel to set the value of the iconName property in the instance of the TaskCellVi

Cites Charlie Page · 2021-03 · Stack Overflow · on “MVVM with Repository/Firestore - Where is the best place to store different queried arrays from a single collection?”

I am building a ToDo List App using Firestore based on this google tutorial [this video] , with a SwiftUI app using an MVVM/repository pattern, that uses one load query to find all tasks ("actions"), and I'm trying to set it up so I can have multiple date-based queries (e.g. display dates for today, for next week, possibly on the same screen) The current version I'm working on has one single "loadData" function in the repository that is saved to a single published "actions" variable, and called when this is initialized. class ActionRepository: ObservableObject, ActionStoreType { let db = Firestore.firestore() @Published var actions = [Action]() init() { loadData() } func loadData() { let userId =

Cites Zonker.in.Geneva · 2021-04 · Stack Overflow · on “Why doesn't my UI update after adding a ViewModel to my SwiftUI app?”

I've been following the Peter Friese YT series on SwiftUI & Firebase [this video] , starting with parts 1 and 2. Now I'm trying to transfer what I learned there into my own little test app, specifically adding a ViewModel into the mix. Peter's app has a single screen interface, whereas I want to use a second screen to enter several pieces of data for the new element and when the user clicks "Save new element", it's added to the array and then is returned to the first screen. Prior to adding the ViewModel code, it works exactly as intended: new element created, added to the array, UI updates. It also works for updating an existing element. After adding the ViewModel code, it almost works. new elem

Cites Zonker.in.Geneva · 2021-04 · Stack Overflow · on “SwiftUI and Combine”

I'm following a video on the Firebase YouTube channel [this video] . Starting around 27:45, the instructor is trying to set a variable based on a Boolean and ends up with the following code in init(task: Task) : $task .map { task in task.isCompleted ? "checkmark.circle.fill" : "circle" } .assign(to: \.completionStateIconName, on: self) .store(in: &cancellables) This seems overly convoluted to me. First, I can't find documentation on using .map on a struct object, only on arrays, etc. Second, what is with this &cancellables thing? (It's defined as private var cancellables = Set<AnyCancellable>() before the init{} .) Third, why all this code, and not simply: task.completionStateIconName = task.isCo