Posts

Showing posts from October, 2019

Ray Wenderlich First iOS SwiftUI App Course - Part 5

Image
Yes three days in a row! Though the blog date for one of the entries was the 25th when it should have been 26th...anyway not to worry. Last bit of Ray's course! Start Time - 18:11 Right, the last bit to do will be the graphics - the different pictures and views. Images This is a bit I sometimes get confused with. All of the images have been created specifically by Ray - for me it's just clicking and dragging to the assets folder. So 1x, 2x and 3x. We don't need to use 1x any more! No need to bother with that. I remember using a programme I had downloaded that create all of these for you. Anyway, leaving that for now. This is the website with the guide to device resolutions - https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions Background is a method that can be used. Awesome! View Modifiers *Delayed for around 15 minutes There is a great website www.iosfonts.com This basically has all the info for using specific fonts! This is SOO...

Ray Wenderlich First iOS SwiftUI App Course - Part 4

Yes! Some momentum - four entries this week is pretty good. Right, straight on to the next part! Start Time - 09:07 More Swift Basics A challenge straight away! Showing the score. OK, let's have a go... I got MOST of this but tried to put in the code inside the function, rather than in the button bit of code. No matter - still getting used to SwiftUI. Paused at 09:23 (need to sort breakfast!) Restart at 09:46 Right, so the bug in the code is that the target number gets updated before the calculation, so we want the updating to happen after the alert button is pressed.... So this works! What you need to do is put the code inside the curly braces by the dismiss button. This means that the code actually happens when the button is pressed. This makes sense for updating. I've had this before in games with the round changing before the points have been updated etc. Challenge - tracking rounds! OK, so for this I need the state variable. I'm getting used to that...

Ray Wenderlich First iOS SwiftUI App Course - Part 3

Image
Here we go! Back from Thailand and a couple of days of Half Term left. Man it really makes a difference using the screen and not having to squint! Carrying on with Ray's excellent first Swift with UI App... Start Time - 11:15 SwiftUI Binding So at the moment the slider does not work. Bindings are ways of saying a view will always be tied to a STATE variable. So we will bind together the slider with a state var. Ok so I have put in the lines of code, thus BINDING together the state var with the slider. Cool! Strings String interpolation - know all this. Variables Again, real basics here. Casting from one type to another. Each variable has a certain lifetime. This is to do with scope. Local variables etc. Swift Basics I know this will be a lot of recap so more of a skim through... Swift Standard Library Stuff about Int random. Point is you do not need to memorise everything. You learn as you go then refer back to bits etc. Writing Methods Putting in a ...

Ray Wenderlich First iOS SwiftUI App Course - Part 2

Image
Here we go! Consecutive days baby! No need for more info - straight back into the next part of Ray's course.  Start Time - 14:58 Realistically I have 40 minutes here. At least another chapter or two! Using Interfaces with SwiftUI This is all about getting the layout done. So probably will just be on this chapter for now. Phone resolution guide  - use to figure out differences between screen sizes. Number of pixels - only important for designers. Developers work in points! Cool, some good bits about getting to landscape, changing the view on Xcode. All good. But only around 20 minutes left and have barely started this chapter. SwiftUI Views Stuff about views. We need four rows of views on a v stack. Side by side for the children views. H stack views within the V stack container. Cool! I love the whole stack, then adding the text. This is much better than adding the various labels.... so far I definitely prefer SwiftUI. Challenge! I need to add in the o...

Ray Wenderlich First iOS SwiftUI App Course - Part 1

Image
So on holiday in the beautiful, tranquil Wora Burra hotel in Hua Hin, Thailand. What better to do than a bit of coding?! Honestly, I love doing this and it is not in any way a chore. I just wish that I could sustain some sort of momentum with it. Life - work mostly - manages to get in the way. OK, we're back to the first app course. This time with the actual UI stuff! Let's get into it.  Start Time - 10:57 OK slight snuggle - Xcode beta needs to install additional components... Just going to watch then pause at the point I need to. So one of the benefits of SwiftUI is the 'live' update to what the interface looks like. It is on pause by default but can be played easily. This is cool - it means that you don't have to test on the simulator every single time!! You can still choose a simulator to run it on. This is separate from the live update of UI. OK Xcode updated, ready to go! I've loaded the Bullseye file from several weeks ago. Neat little trick -...

Ray Wenderlich Fundamentals Course - Part 5

Image
OK last part! I'm going to complete this fundamentals course today! Also, Xcode looks like it's ready for the official update - so I won't need Beta anymore. Anyway, time to go for it. Start Time - 20:44 Structures Grouping sets of related data together. Technically, all of the below are structs!   struct Student {          let name : String     let grade : Int     let pet : String ? } let bobStudent = Student (name: "Bob" , grade: 33 , pet: nil ) Most of this is recap so skimming through *Technical glitch for 5 approx minutes. Wifi back on! Mutating. I've made sense of this at last! If you do a function that alters one of the STORED PROPERTIES e.g. grade, then I have to use the mutating keyword. Cool.  Value type. I could clone an instance. That new version is unique and does not affect the original. Class (reference types) do.. It's also got to be a var, to change any of the va...

Ray Wenderlich Fundamentals Course - Part 4

Here we go! Last chapter of the course for fundamentals. This one is a bit longer so may need two entries. Let's go! Start Time - 17:39 Compound types - e.g. for tuples. This is about information being bundled together. Value and reference types - we'll be coming to that! Functions func printPass (grade: Int , pass: Int ) {     if grade >= pass {         print ( "Your grade score of \(grade) has passed! You passed by \(grade - pass) ." )     } else {         print ( "Your grade score of \(grade) did not pass!" )     } } printPass (grade: 72 , pass: 50 ) I've elaborated on this a bit.  OK, difference between parameter and argument. It's called parameter when declared. When called, and providing values, it is an argument! Cool, that does clarify.  func printHighestGrade ( _ grade1: Int , _ grade2: Int ) {          print (grade1 ...

Ray Wenderlich Fundamentals Course - Part 3

Yes! Finally some momentum. I'm basically going to continue with the Fundamentals. No more than 45 minutes to help out the old eyes! Start Time - 19:47 More Collections Dictionaries Mostly recap I reckon. Key-value pairs, unordered etc. Interesting - you can't have the same key! Didn't know that to be fair. Not going to put the whole dictionary in but some stuff you can do: for (name, pet) in namesAndPets {     print ( " \(name) has a pet called \(pet) " ) } let thorPet = namesAndPets [ "Thor" ] ?? "Nothing for thor" The second one of these is nil coalescing. It's a bit like ternary. These are pretty cool too: for (name, _ ) in namesAndPets {     print ( " \(name) has a pet!" ) } for pet in namesAndPets . values {     print (pet) } Challenge time! All good! One thing to check was adding a new item - needed to use the syntax NOT with update value.  Sets Have ...

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 ...

Ray Wenderlich Fundamentals Course - Part 1

So, as expected, I can't use the Swift UI functionality yet. Not at least for a few more days. So I'm going to focus on this fundamentals course, which should just be recap. I need to keep my eye in as I feel it slipping away with all of the delays. So a little bit of time now, whizzing through the core concepts.  Start Time - 15:51 Technically we're out of sync as this should follow the Bullseye app. But I can't do that without the Swift UI stuff. But that's fine. Playgrounds This is all VERY basic. So far we've got creating a string for a message and where it appears. Then printing it. Think of playgrounds as a notepad for trying things out. So, unlike the Lynda course, it makes sense to REALLY skim through this. Just basically pick out any nuggets! *Markdown - go to editor/show rendered markup to get the proper view! OK, one useful thing learned then! Booleans and Comparisons All recap here. Nothing new. Comparing ints, doubles, strings et...