Posts

Showing posts with the label where clause

Ray Wenderlich Fundamentals Course - Part 2

Image
Yes! First consecutive entry for a little while. Good news - I have sorted out the UI stuff so I have Mac OS Catalina - the beta version. I've changed my account so I get to have the beta stuff basically - ahead of time. So when the actual update comes up, I will just get that for the 'normal Xcode'. Anyway, I want to complete the fundamentals course. It's been very, very basic so far. So will skim through the content and just get to the challenges. Also, I'm aiming for no more than an hour at a time, but in 2 possible stints today. So stint 1 is to get the next chapter done. Here we go! Start Time - 11:49 COLLECTIONS Tuples One thing to type - that you can assign multiple values in brackets to the entire tuple, then each of those values is saved separately. let wrestlingFacts = (name: "Kevin Owens" , didWin: true ) let ( name , wonMatch ) = wrestlingFacts So now 'name' and 'wonMatch' are their own values. I could use ...

Treehouse Intermediate Course - Part 7 (Generics 5)

Image
The roll continues! So I will do similar to the other week - do several entries within one blog as it may be a bit stop-start. I've got around 20 minutes now just to make a start. By the end of today I will be finished with generics! I will then do a follow up consolidation entry with extra practice before moving on! Start Time - 12:53 Associated Types Can protocols be made generic? It is already in the sense that any type can conform to a protocol. But what about the internal? As in the code that goes behind the scenes... Stack - a bit like an array but more limited. The main point is the order - last in, first out. That makes sense. Associated type for the function - you can use a placeholder name for the type that is used in the protocol. The actual type is not specified until we actually adopt the protocol. Here is the protocol - protocol Stack {          associatedtype Element          mutating func push...