Pagasi Journal starting the beginner classes!

Well… I’m really starting to get lost in all the code on the quiz app… I think its mostly the amount of things named question questions Questions, or some variant. compounded by the fact that you can redeclare questions in different functions… the plan is to go through the code and use the thing where you click on a thing and it shows you all the matching things highlighted until I figure it out before moving on. I think I understand, its just looking at the code gets sooo confusing.

Hold command, then click on a variable (or anything really)

And then click “jump to definition” this will tell you what “question” actually means.

It can be confusing, but look at the syntax highlighting in Xcode, and figure out WHY are you writing the code that you’re writing.

I suggest, watch the video once first (without coding along) and then go back and code along.

Sometimes it can get confusing typing so many things while also trying to pay attention

1 Like

hmmm I’m pretty stumped here… I just rewatched the video twice to double check my code, but when I try to run the quiz app with the new ResultViewController we just made it will run, but as soon as I click an answer it will crash with “This class is not key value coding-compliant for the key nextButton.” on the AppDelegate class… which I know nothing about and therefore can’t troubleshoot. I may have to reverse the build until I find the problem… Good news is, I’m still well motivated to work on this, so tomorrow I’ll try to hit it pretty hard and figure it out… we will see

Sounds a bit like you have a connection error in ResultViewController. Check that there are no stray connections or broken connections between the storyboard ResultViewController and the ResultViewController.swift file.

well… I deleted the ResultViewController.swift file and just rebuilt it from scratch, same error. It has to be something that happened in this class where we created the ResultViewController.swift file because the thing didn’t crash when I clicked on an answer at the end of the previous lesson. But I’ve triple checked all the code we added this class and its exactly as it says in the class…

Thanks so much for you help!

Okay… so basically I went into my main storyboard and deleted the result View Controller and just remade a new one… of course that broke IBOutlets but after redoing that (again) it works!! YAY. now of course that was after I downloaded CWC’s version and compared every single line of code in the entire project, found several other small discrepancies on the main story board, none of which worked, and then finally just started deleting entire items from my project and replacing them with the same item from CWC’s project lol! nothing was working, its almost 2am now sigh. I’m glad its fixed, at least tomorrow I can continue to Module 5 #8. I wish I knew exactly what was broken. cause all the numbers and specifics from the lesson were correct. I imagine I accidentally bumped something that broke it.

Well today went very smoothly! completely contrasting with yesterday where I was up into the late hours of the night trying to debug lol. I totally took both of your suggestions @MikaelaCaron and watched Module 5 episode 8 all the way through just for comprehension before writing any code. It definitely helped because of course I forgot to designate the ViewController as the delegate for the ResultViewControllerProtocol but it only took a few seconds to figure it out because I had actually been paying attention the first time I watched it. And secondly I used the control jump to definition twice to clarify what some code meant. Very helpful! thank you!

1 Like

We are on a roll! I got basically listened to Module 5#9 in the car twice today before actually sitting down at a computer just before work and whipping up the code, no confusion, everything makes perfect sense! this listening before doing is awesome! … if a bit more time consuming

I often watch a video through first without coding along at the same time, then watch again while coding at the same time. That works for me too.

Today was a bit more casual. I did the class on interacting with websites.

I thought about uploading a JSON file to my website, but couldn’t be bothered today… I know I’ll have to one day, I’ll figure it out then… I also skipped the step of watching the video before doing the code today… but I did go through the steps for what you have to do to work with a http website. and I did go back over the code after. It does seem to make sense. The real secret here is in the practice. getting to the point where I can just write an app a day is gonna be a big deal for my brain style.

Okay, I’m starting to feel the pressure of School is about to start, and the baby will be here in a month. yesterday I did take a day off for the baby shower, today went pretty smooth but I can see how school routine is going to be challenging since my wife and I chose to do school from home lol dear god…

On the other hand, tomorrow I’ll be finishing up the quiz app, and starting on module 6! that’s encouraging. mainly because I can feel myself starting to get used to all the basics. But I can also see how night impossible it can be to get my own build to succeed without Chris telling me all the ins and outs every step ofthe way lol. like the self command? or broken Outlet links? or knowing when to run something on the main line etc. whelp! one day at a time it is.

1 Like

and just like that, the quiz app is done! I don’t think there’s a place to post a screenshot or anything, so I’ll just say it here :slight_smile:

Just thinking things through here on protocols and delegates

//Protocol file:
Protocol DoTheThingProtocol {
//“Hm I need someone else to do this thing for me”

func thisThingHere() }
//“They will need to be able to do this thing here”

//Delegate file:
class OhPleaseLetMe: DoTheThingProtocol {
//“I could totally conform to that protocol! ahem I mean… do that thing!”

//Protocol file:
class DoItHereInThisClass {
var delegate: DoTheThingProtocol?
func functionThatNeedsTheThing () {
//“Wait Delegate File! not yet, I need you to do do it later… during this Class over here when they need to do this function. also, take this pager, put my number in it so you know its me calling, and when I’m ready for you to do the thing I’ll page you”

//Delegate file:
var pager = DoItHereInThisClass
pager.delegate = self
//“lets see… his number is doItHereInThisClass, attaches pager to belt… done!”

//Some random file:
var pager = DoItHereInThisClass
pager.functionThatNeedsTheThing()
//“Hey Protocol file! …Its time to do the thing”

//Protocol file:
delegate?.thisThingHere() } }
//“Okay Delegate file, NOW do the thing.”

//Delegate file:
func thisThingHere() {} }
//“Done! And you’re welcome”

————————————

Protocol File:

protocol DoTheThingProtocol {
func thisThingHere() }

class DoItHereInThisClass {

var delegate: DoTheThingProtocol?

func functionThatNeedsTheThing () {

delegate?.thisThingHere() } }

————————————

Delegate file:

class OhPleaseLetMe: DoTheThingProtocol {

var pager = doItHereInThisClass

pager.delegate = self

func thisThingHere() {} }

——————————————

Random file

var pager = DoItHereInThisClass
pager.functionThatNeedsTheThing()

another day another class! I really appreciate when we relearn something we learned before, I can feel it getting cemented in the brain lol. Not enough to replicate on my own yet, but getting there for sure

Okaaaaaaay. so on the news app my weblink and key for the api apparently got outdated? I had yesterday’s link which included yesterdays date in the http address apparently crashed my app. I couldn’t figure it out. I looked at CWC’s code for like an hour comparing line for line with my code and everything was identical. I tried debugging but I could see that basically it was connecting to the API and then not grabbing any articles. it did grab 255 bytes of data but no articles. I finally realized that literally the only difference between my app and CWC’s app was the http link and key to the api. So I pasted his in the place of mine and BAM it worked perfectly. So then I went and recopied my own link and pasted it and it worked as well! so then I was like so how was that link different from the one from yesterday? well it has today’s date in it instead of yesterdays so it literally just changed a 3 into a 4 and that fixed the whole app. … fixing apps is super frustrating. Also how am I supposed to use an api link that changes everyday?? this seems useless

You would calculate the day and could change the API link dynamically everyday the user uses the app!

Programming is tedious. If I was easy everyone would be doing it !

1 Like

Yeah i get it, just blowing off some steam in the journal… tomorrow I’ll be figuring out how to code the current date, should be fun :wink:

1 Like

I totally copped out, used a different news feed that didn’t use a date in it, turns out they offer several different feeds lol

Its cache day here! learning all about the cache. Its also the day before school starts for the two boys… and 22 days before the baby is born. I was able to set up for online school tomorrow as well as take the class on cache, still have a few hours until work starts, today went pretty well if I do say so. the true test will be when baby gets here lol! As a piano teacher I know that when one of my adult students says something like “Hey! we are having a baby! I’m gonna take a few weeks off and come back when we get things under control”. that translates to “I’m totally quitting cause I don’t even have a clue about the chaos this baby is about to bring to my life”. LOL. My mission here is to stay the course! I plan to take a few key days off, but then at the very least rewatching a video I’ve already learned on my phone each day if I’m not able to get to the laptop to code. Its the 3rd kid, its not like I don’t already know lol I can do this!

so this is new. Today I did the segue tutorial for the news app, and everything seems fine except something to do with the WebKit? I get this error on the class AppDelegate: UIResponder, UIApplicationDelegate:

“Could not instantiate class named WKWebView because no class named WKWebView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)”

This confused me on a couple of levels so I downloaded the CWC version of the code and ran it and got the same error. That’s the first time that’s happened to me. So then I came here to make a request for help, and just lost like 20 minutes looking for that post that explains the rules and helpful hints on how to do that… still didn’t find it, I know its there but I’m too tired to keep looking. I’ll probably work on it tomorrow if I find time. Video school started today with my two kids, to be honest I’m just proud that I actually did a class period, getting it to work out perfectly may have been asking too much lol… on to tomorrow… oh look! it just hit midnight, sooo… Hello tomorrow! lol