Posts

Showing posts with the label Stephen DeStefano

Stephen DeStefano Swift 5 Course - Part 10 (Lectures 55 to 58 - STOPPED!)

Image
So I've managed to leave it nearly a week! Couldn't be helped as the weekend was so busy and just didn't get the chance Tuesday or yesterday. Anyway, I've got onto the good stuff...the projects! I hope these live up to the hype I've created in my head for them. Once I've got the first couple of these done, I am going to seriously look at the best way forward, coding-wise. It could be Treehouse! Right, let's get started.. Start Time - 10:21 Brain Training! This sounds like fun! Sprite Kit is going to be used - I've had very little experience with that so that could be useful. Here's how it looks - ML - not sure what this stands for yet! Right, it's Machine Learning. My Xcode is still updating - so I can't follow along just yet. So we are 'training a model'. It could be something like distinguishing between cats and dogs. In this case it is distinguishing between numbers! So the handwritten element to this sounds cool. Pr...

Stephen DeStefano Swift 5 Course - Part 9 (Lectures 39 to 54)

Image
Here's me maximising time! I'm getting on a train in little under two hours. So a perfect time to code! I've actually packed everything, apart from what one needs post shower! So time to get the 'what's new in Swift' bits done. Then it can be the practical, project-based part! That's where I tend to REALLY learn! So let's get these bits done today.  Start Time - 07:44 New in Swift 4.1 Equatable protocol - allows you to compare an instance of a type against another. Not sure what all that means to be honest! Hashable - again, something that Swift can now do that used to be quite verbose code. Key decoding strategy for codable - something about going from snake case to camel case... Conditional conformance - now able to make easier comparisons. Possible to add protocol conformance to a type, as long as it satisfies the condition. It's supposed to make it all safer - the compiler won't build whereas before it would crash... Recursive ...

Stephen DeStefano Swift 5 Course - Part 8 (Lectures 32 to 38)

Image
Yes, two in a day! As mentioned earlier, I want to crack on and get the technical stuff DONE! Just want to get on to the projects. So the plan is to get at least collections done, then hopefully enumerations (maybe error handling too!) Start Time - 20:08 Arrays Again, as with other stuff in this course, I know this well so more of a skim through. A couple of cool things. The default value part is the same item repeated basically. The adding two arrays together means a bigger list basically. Can use the isEmpty property. Then use that within an if statement. Other stuff insert at, append, remove all etc. So using the range ... to put in several values at once. Iterating over the array. Use of the if let to see if an item is in the array. Use of sorted function. Then 'by'; you can use the < or >. Or others probably! Quiz - 10 out of 10 and one of the easiest so far! Dictionaries The syntax and concept of these is absolutely fine. Key-value pairs...

Stephen DeStefano Swift 5 Course - Part 7 (Lectures 26 to 31)

Image
So continuing with Control Flow! Going to do approximately an hour now - so that will be the rest of this chapter, then the next one on Strings.  Start Time - 13:20 If/else Just a catch up on this - skimming through! Simple example above. The use of else if as the alternative cases. Nested if statements - having an if statement with one that follows immediately. Simple. Switch Statements Again, I'm happy with this. Has to be exhaustive, is better for situations with numbers. Using several values for different cases - And this is with number ranges - Tuples with switch statements - Again, straightforward stuff. You just need to do the case with two values (as there are two - cars and weeks). In the above, there are closed values, the wildcard bit (underscore used). You can also use value binding by creating a value within the case  - So you then use those temp values that have been binned within the print statements. Where clause - can be u...

Stephen DeStefano Swift 5 Course - Part 6 (Lectures 23 to 25)

Image
Yes cracking on! Got a bit of time this morning before heading to my Uncle's and Auntie's. I want to cover Optionals then Control Flow. All very doable! Let's go! Start Time - 08:19 Optionals So I know about these but good to go over! They're used in situations where they may not be a value stored. Nil means the absence of a valid object. You can do these for any type at all. Optional types are returned where there may not have been a value e.g. when converting from string number to actual int number. The question mark syntax. Good way of understanding this is that the ? QUESTIONS whether something may not have a value. So the question bit is key there! You can only use nil with optionals. Optionals can only be var as the values are likely to change. If you create an optional without an initial value then it automatically sets this to nil. Forced unwrapping Comparing the optional against nil.... That's not forced unwrapping - that's just ch...

Stephen DeStefano Swift 5 Course - Part 5 (Lectures 17 to 22)

Image
I'm back! So a good turnaround from the last entry! Yes, I'm going to make time! We're diving into classes and structures, which is always a useful comparison.  Start Time - 15:42 Syntax Ok so a good overview! Syntax I'm fine with so just a recap here. Properties - accessed with dot syntax. Dot syntax - can be used several times e.g. if there is a custom type within the class/struct, then the property of that is used. Sounds complicated but actually very simple! Initialisation -   A good definition! Stored properties cannot be in in an indeterminate state. That means they can't just be up in the air.... So either give default values within the body of the class/struct, or have them created upon the instance being declared. So if a property will always take the same initial value, then it's best to do it as a stored property. Makes more sense then having to init this every time! Value vs Reference Types Ah the age-old debate! In th...

Stephen DeStefano Swift 5 Course - Part 4 (Lectures 12 to 16)

Image
Not going to go into rambling detail about how it's been a long time etc. End of term, start of holiday is always mental! I have missed my regular coding so am going to get some in today, then there will be more on Monday! I was working through Stephen's course, which was becoming pretty technical and challenging. Let's go! Start Time - 07:17 Stored Properties So these store constant/variable data. A key point here. Structs are value types - if you have a constant stored property, you cannot change the value. You can for classes as they are reference types. All that was pretty easy to be honest. Lazy Properties So I'm just trying to figure out the purpose of these! Stephen is quite rambling. OK so when the property is actually initialised, that's when the lazy stored property is accessed. It's about saving memory. So not created until it has actually been used. If it's computationally expensive - if it will end up slowing things down! Right...

Stephen DeStefano Swift 5 Course - Part 3 (Lectures 8 to 11)

Image
Well it's been a good few days but I'm back! No need for more of a preamble than that - straight into functions! Start Time - 14:06 Functions These are SELF-CONTAINED. It is best to name what the function actually does. Syntax - the name, parameters, return bit etc. Nothing else new here. Bit about the return value and print statement used. Underscore - placeholder for a constant/var without an actual name. 9 out of 10! Only one that was wrong was a bit of a trick question. OK next! Returning Multiple Values So this of course means returning a tuple All very technical - again, Stephen combines lots of elements - for loops, if statements, optionals...all hard to keep on top off! Names of return types - optional. Used to improve readability of code. Argument Labels and Parameter Names Argument label - used when calling the functions. Better for readability. Swift used the parameter name as the default. Labels are used on the outside - on the left of th...

Stephen DeStefano Swift 5 Course - Part 2 (Lecture 7)

Image
So a busy few days; no time at the weekend at all to code! No issues - I've got a little amount of time today and will certainly make more time for coding this week. Going to continue with Stephen's course! Start Time - 19:52 Tuples Skimming through this. Multiple values declared together. It is not limited by a certain type. Use of . syntax e.g. .0, .1, .2  - indexes like an array. You can name the values in a tuple - this improves the readability. Still use the dot index or the name of the property. Either way. Decomposing - breaking down the tuple and storing elsewhere. You can use empty parameter name (__) Iterating through dictionary by the use of tuples - So the tuple names in brackets have been created for the purpose of iterating. Another example - In the above, the use of tuples is in the return value part. That's cool - I've generally only used one type in the return part. Cool! So I've noticed something. Stephen throws in a LOT...

Stephen DeStefano Swift 5 Course - Part 1 (Lectures 1 to 6)

Image
After completing (yes ALL of!) Nick's Swift 5 course, I'm going to undertake another one on Udemy. I'm content to focus on these refreshers/building in some new info course. The reason why I want to do this one is because there are built in quizzes. I want to make sure I understand what I'm doing! Start Time - 19:54 Intro So the first part is the basics of Swift (I will skim over), then it will go into actual projects. Cool! Language Intro More intro and info! Stephen makes the point of skimming through the language part of the course if I am at an intermediate level. I really want to go through the info and ensure I have a secure understanding, before the projects! Constants and Variables Real basics here. Yes all straightforward. Skimming through to get to the quiz! 10 out of 10 on first quiz! Now onto part 2... Multiple statements on a single line - use semi-colons to separate. To be honest I don't think I will ever do this! Double - precisi...

Bob Lee Course Part 17 (Lecture 29)

Image
Unusual time to be doing an entry? Yes, absolutely! I have laryngitis - so I basically have to be off work, both yesterday and today.  A blessing? Probably! Well, the upshot is that I get to do some coding today, a rare treat. It's been difficult finding any time recently due to going to the F1 in Abu Dhabi, work and laryngitis! So, let's pick that up with Bob's course. Last time it was an introduction to closures. It was hard! From what I remember, closures are another way of writing functions. They can actually be simpler - VERY simple if you use the $ syntax for accessing the values. Still, the whole thing was tricky. Let's continue with the aim of finishing Chapter 3 today! Start Time - 11:27 Lazy Init with Closures My take - I know a bit about lazy already. I know that this means the value does not take up any space until it is used. So it is good for memory management. So that is the code for creating a UIButton. Bob's point here is that to create ...