SwiftUI MyTask App: Building Add and Detail Views | SwiftUI Hindi tutorial (Day 3)

preview_player
Показать описание
In this SwiftUI Hindi tutorial, we will dive into building a My Task app from scratch. Our focus will be on creating the Add and Detail views, essential components of a task manager application.

By leveraging SwiftUI's declarative syntax and powerful features, we will explore how to design intuitive user interfaces for adding new tasks and displaying detailed task information.

Whether you're a beginner or an experienced iOS developer looking to learn SwiftUI, this tutorial will provide you with practical insights and techniques for building engaging task-based applications.

Join us and enhance your SwiftUI skills while creating a fully functional My Task app.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✅ Subscribe to the channel and stay ahead of everyone by following the right way for writing clean code in swift. 🔥🔥🔥🔥🔥

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----------------------------------------------------------------------------------------------------------------------
📥 Download the source code from

-----------------------------------------------------------------------------------------------------------------------
############################################

Connect with me on social media
Instagram: codecat15

###########################################
#swiftUI #swiftUIHindiTutorial #swiftUIForBeginners
Рекомендации по теме
Комментарии
Автор

Hey Ravi
The content is insightful, and I’ve gained a lot from it. However, I have a question: why are you initializing Task with a default value? Would it be possible to use an optional type instead?

shubhammayankgupta
Автор

@Ravi Here is my one query

Can we use protocol in view model and use in this struct like below code :

protocol TaskProtocol: ObservableObject {
var task: [Task] { get set }
func getTask(_ taskState: PickerState)
var defaultTask: Task { get }
}

final class TaskViewModel: TaskProtocol { .... }


struct TaskView<ViewModel>: View where ViewModel:TaskProtocol {
@ObservedObject var viewModel: ViewModel
}

Is this right?

Need your suggession

geetikagupta
Автор

At 13:25 you did the same mistake again. You created selectedTask property and it is of type Task. Task is a model, it should never be directly used in the View. You should create a VM for selected task and then use that VM instead of breaking separation of concerns and exposing the model directly to the view. I hope you can see the clear mistake you are doing all over the code.

SameerPatel-fz