Bob Lee Course Part 1 (Lectures 1 to 4)
A new course! Yes, it may seem random and rash to suddenly change tack like this. However, while I was working on the Clima project, I realised that great as Angela's course is, it's not up to date. I resent paying for the new one and redoing what I already had done, just to ensure that there's nothing redundant. Basically, I reckon it makes more sense to focus on a new, fresh course that is actually at an INTERMEDIATE level! I loved Bob's explanations on delegates before and have actually paid more: £31.99 for this (usually around £10 to £12), though I did get an added discount. Anyway, I want to see how this goes and feel like I'm ready to be going in deeper with concepts I know well now. Just gonna do a max of half an hour today. Here we go!
Start Time - 20:33
Couple of things to get started - Swift Community to join and eBook to download.
OK all done!
Bob makes it clear that this is not for beginners. I'm glad I am - I feel like I know the syntax well!
Right first lesson...
Optionals
Bob makes a good point here. When he started out, he was learning with Udemy, Treehouse...very much like me! Everything possible within the budget. Lots of the instructors don't really explain why the optionals are actually used. Yes, that is a good point Bob!
Recap of explicit/implicit types:
All familiar. I know that the type can be inferred. I generally always go for implicit now.
So just to summarise - optionals were created to avoid the program crashing basically.
I'll be honest - so far Bob is very enthusiastic but not always coherent. Quite scattergun and rambling but I'm sticking with it!
A key point here is that optionals with a value e.g. var name: String? = "Josh" is a String Optional when printed. The value hasn't been unwrapped - when/if it does - then it becomes a String.
With optional Ints - they do not interact with one another. That's interesting! So two optional ints cannot be added. Didn't know that one!
Unwrapping - all that is fine. Assigning a new value as the forced unwrapped one. But you CANNOT unwrap anything worth nil! Unwrapping MUST have a value!
So now we're going into optional binding. I know that pretty well now. Here's me going straight onto here not via Xcode...
var song = "Under the Bridge"
if let songValue = song {
print(songValue)
} else {
print("There is no value")
}
That's one way of doing it - could have printed another message etc. Also could have done the guard statement. Or the ?? etc. Not as sure as the syntax of either of those though.
Great - Bob's example is pretty much identical.
Nice link to APIs - code written by someone else. So that will give us optional types - so we need to carefully unwrap the values.
Bob calls the optional binding implicit unwrapping. I'll use that for now.
So two main rules:
Finish Time - 21:19 (46 minutes)
Well an interesting start! I'm not blown away but I enjoyed it. I'm looking forward to getting a deeper understanding of the concepts I already know a bit about. More tomorrow!
Start Time - 20:33
Couple of things to get started - Swift Community to join and eBook to download.
OK all done!
Bob makes it clear that this is not for beginners. I'm glad I am - I feel like I know the syntax well!
Right first lesson...
Optionals
Bob makes a good point here. When he started out, he was learning with Udemy, Treehouse...very much like me! Everything possible within the budget. Lots of the instructors don't really explain why the optionals are actually used. Yes, that is a good point Bob!
Recap of explicit/implicit types:
All familiar. I know that the type can be inferred. I generally always go for implicit now.
So just to summarise - optionals were created to avoid the program crashing basically.
I'll be honest - so far Bob is very enthusiastic but not always coherent. Quite scattergun and rambling but I'm sticking with it!
A key point here is that optionals with a value e.g. var name: String? = "Josh" is a String Optional when printed. The value hasn't been unwrapped - when/if it does - then it becomes a String.
With optional Ints - they do not interact with one another. That's interesting! So two optional ints cannot be added. Didn't know that one!
Unwrapping - all that is fine. Assigning a new value as the forced unwrapped one. But you CANNOT unwrap anything worth nil! Unwrapping MUST have a value!
So now we're going into optional binding. I know that pretty well now. Here's me going straight onto here not via Xcode...
var song = "Under the Bridge"
if let songValue = song {
print(songValue)
} else {
print("There is no value")
}
That's one way of doing it - could have printed another message etc. Also could have done the guard statement. Or the ?? etc. Not as sure as the syntax of either of those though.
Great - Bob's example is pretty much identical.
Nice link to APIs - code written by someone else. So that will give us optional types - so we need to carefully unwrap the values.
Bob calls the optional binding implicit unwrapping. I'll use that for now.
So two main rules:
- Every single type in Swift HAS to be defined, whether that is implicitly or explicitly.
- Two ways to unwrap a type - forced unwrap (!) or implicit unwrapping (if let...)
Finish Time - 21:19 (46 minutes)
Well an interesting start! I'm not blown away but I enjoyed it. I'm looking forward to getting a deeper understanding of the concepts I already know a bit about. More tomorrow!
Comments
Post a Comment