Your Second iOS and SwiftUI App · Extensions | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5662524-your-second-ios-and-swiftui-app/lessons/19

I just wanted to chime in and say that I don’t think this video is very beginner friendly. Having to dive into more advanced Swift topics is fine, but I think this video is lacking some explanations about why the IndexedCollection and ForEach code needs to be written in the first place. What problems does this solve for us? I was completely lost while watching this.

1 Like

Just some feedback, I feel like having beginners jump into building a second swiftui app before doing the functions and types course first may be discouraging for some. For me, I am only experienced in Java, so to go from that to a framework with so many functions and little explanations is kind of confusing. Is this the ONLY way that an app like this could be built?

At present, basically, yes. That could change in a month and a half! https://developer.apple.com/wwdc20/

@drerucha is right. It is really not a beginner friendly. And some explanations seems to be insufficient to understand concepts clearly. For example: In Part-3: Video: 19-Extensions (around 2:00 mins) there is a demo(user adds new task → new task is not shown in the list → user deletes a task and new task is shown in the list → user try to delete another task and app crashes). There is no explanation for any of these:
1- why new task was not shown?
2- why new task was shown after deleting a task from the list?
3- why app crashed when trying to delete the second task?
Really, without explanations of all of these and going over code(may be in a debug mode) to show the problem to students, it does not make any sense.
The only explanation in the video is “data and UI are not sync”. These explanation really does not help. it is only stating the result, reality. As a student, you want to know where/why/how caused this.

1 Like

I have rewatched all videos in the learning path at least 4 times each and this part still makes no sense to me :exploding_head:, WWDC is a few days from now If there is an update in many things here I hope it doesn’t take too long to upload the videos :sob:

Hi there I’m having an error where I’m getting an "Invalid redeclaration of “RowView”. The only place that I’ve declared RowView is at the bottom of ContentView.swift and I instantiate it up in the ForEach. Also I have a declaration of RowView in the RowView.swift file, however you did the same in your video so I’m unsure I made a mistake.

Thanks! :smiley:

Upload your project and I’ll have a look!

I think you might have forgotten to delete the RowView declaration at the bottom of ContentView.swift. :grinning:

I’m getting the same error as Use of unresolved identifier ‘RowView’

I have created separate class for RowView and below is the code for the same class.

struct RowView: View {
@Binding var task : Task
var body: some View {
Text(task.name)
}
}

struct RowView_Previews: PreviewProvider {

static var previews: some View {

RowView( task: .constant( Task (name: “To Do”) ) )

}

}

When I try to initialise that class in other class under ForEach block. I’m getting the error. can some one help me out.

List{
ForEach(taskStore.tasks.indices) { index in
RowView(task: self.$taskStore.tasks[index])
}
.onMove { sourceIndeces, destinationIndex in
self.taskStore.tasks.move(fromOffsets: sourceIndeces, toOffset: destinationIndex)
}
.onDelete { indexSet in
self.taskStore.tasks.remove(atOffsets: indexSet)
}
}

NOTE: New task is not getting added due to this issue.

I breezed through the ‘1st Swift App’ course, learning small things all along but never feeling stuck or even having to replay more than a couple videos. I even picked up enough to make my own customizations to the app as we went along, which actually made the process fun.

This episode however, introduces a lot of stuff (even if it is just in passing), but I don’t feel like I understand the ‘why’ well enough to even fit the new info into a mental model for later use. That’s a bit discouraging.

I did a bunch of digging as I went (thanks to Ray’s repeated suggestions to use Opt-Click for “Quick help” in the 1st App course), and was able to fill in a few blanks on my own. but I’d rather have this course broken down to fit a ‘beginner’ learning curve a bit better.

Jessy, I was just wondering if you saw anything in the WWDC 2020 videos that suggested there will now be a cleaner way to accomplish the same thing as in this section of your course but without having to use RandomAccessCollection extension code. I’m not looking for that solution here, but was more just curious if you saw anything that might simplify things going forward. Thanks!

I’ve watched all the sessions, and tried out a lot of new stuff, but nothing so far has been the obvious answer for what you’re looking for. I’ll be working on the update to this course later this month though. Here’s hoping!

1 Like

I added them to the project copying in the same folder as TaskList.
I went to Files>Add files to “TaskList”… and added them.
Is this the proper way of adding them?
Later in the course it looks like they aren’t used.

I agree with the above. I’d been following solidly for the learning path so far, and getting a HEAP out of it. But jumping straight into creating this app feels like I’d skipped multiple modules. It’s basically just me copying what is being typed with absolutely zero understanding why I’m doing it and how.

Please check out the updated version of the course when you get a chance:

https://www.raywenderlich.com/15234721-your-second-ios-and-swiftui-app

I hope it helps!