Posts

Showing posts with the label return type

Lynda Course - Swift 5 Essential Thinking (Part 4)

Image
Am smashing through this course and enjoying it! Probably because it's mostly recap and consolidation. Anyway, got a bit of time before a brunch today so no time to waste! Start Time - 11:26 5. The Wide World Of Functions So a point here is that a lot of these are already built into Swift. But we can create our own of course! Basic functions All good recap here. Overloading functions Heard of these once before in Pasan's story course. So this is using the same name for multiple functions, as long as their signatures are unique. // Base function func attackEnemy() {     print ( "Attacking enemy..." ) } // Overloaded functions func attackEnemy(damage: Int ) {     print ( "Attacking enemy; \ ( damage ) caused" ) } func attackEnemy(damage: Double , weapon: String ) -> Bool {     if damage > 8.4 {         return true     } else {         return false ...

*Consolidation Entry* Closures Part 1

Image
*A HUGE gap since the last coding session. Various reasons why - work, personal...and to be honest, the idea of getting back on it hasn't appealed as much because of the time trickling along. Anyway, I have to take ownership for that lack of commitment, accept it and move on! The longest gap between entries for around a year is nothing to be proud of and I will endeavour not to let it happen again. In fact, Ramadan is about to commence so the PERFECT opportunity to get stuck back in and make up for lost time! So as promised, rather than cracking on with Angela's course, it makes more sense at this point to go over closures. It is something that still boggles me and before going on with any new content, I want to understand them better! *This does NOT mean that I'm having Angela's course - I will come back to it! I'm going to go over Bob Lee's points on closures - see what I can glean and then go back to Angela's. Let's go! Start Time - 11:37 So t...

Sandra L Course Part 2 (lectures 11 to 15)

Image
Before I begin the second part of Sandra's course, I made a couple of final (I know that I should just leave it!) tweaks to How Many Letters. One flaw was that the number in the text box would still be there after clicking the button. That's fixed now! Was actually quite easy - a function that basically changed the value in the text box to an empty string. Also, I added a button with a segue to an information page.  Start Time - 21:24 So I'm cracking on with Sandra's 'easy' course - the first bit was anyway. Hopefully it'll be more challenging soon but not make the giant conceptual leaps that Bob's code did! Collection Types: Arrays var numbers: [ Int ] = [] numbers . append ( 4 ) All fine to be honest.  There are various in-built functions with these that you can apply e.g. remove at last, remove all, count etc.  This is all VERY easy. I'm a bit concerned! Going to crank up the speed... Dictionaries Main difference...