Posts

*Final Entry For This Blog*

Having not being able to do any coding or Swift learning since 20th March - nearly four months - I've finally managed to come back for it! The main reason is that with lockdown, Learning From Home meant a LOT of screen time. Being in front of a laptop for an intense amount of time per day essentially meant that I did not have the capacity to do any coding at all. So I haven't! It also means that I need to conclude this particular blog as it feels strange to continue it after so much time. It does NOT mean however that I am giving up or quitting on Swift though! I still believe that it is a great skill to develop and could still be an opportunity to transition a career towards. So, to wrap things up here, this part of my Swift journey is over. I need to start a new blog with a fresh start and a fresh opportunity to rebuild my skills and take them to a new level. Signing out of 'Josh's Swift Journey' - the road is far from over!

RW.com: Navigation Tutorial - Part 1

Image
Alright! A new article - technically a tutorial to focus on. This one is all to do with navigation. Start Time - 14:20 Here is the link, from Audrey Tan: https://www.raywenderlich.com/5824937-swiftui-tutorial-navigation Before I start, just having look to see what's there. Good to see the ContentView empty at the moment - that's genuinely good to see we're adding from scratch! In the 'Artwork' file, we have a custom struct for Artwork, then an array full (17!) of different artwork values. Each has a whole list of properties. In the MapView file we have some code that I'm not familiar with. OK, let's go to the actual tutorial! SwiftUI Basics Yes I agree with Audrey - I MUCH prefer how the code directly matches to the view, so you can keep track of it all. Also, just the one main ContentView is easier than using storyboards. Another key point is that UIKit can still be used alongside UI. Declarative App Development So what does declarat...

RW.com: Animations Article - Part 2

Image
The run continues! Will be good to make the most of it, as there will not be anywhere near as much time over the next few weeks. Anyway, second and final part on animations. Let's do it! Start Time - 15:04 So we are starting with combing transitions Combining Transitions Here is an extension on AnyTransition - extension AnyTransition {     static var customTransition : AnyTransition {       let transition = AnyTransition . move (edge: . top )         . combined (with: . scale (scale: 0.2 , anchor: . topTrailing ))         . combined (with: . opacity )       return transition     }   } This basically means that there are three specific transitions saved into customTransition - and that is specifically for the type. I'm starting to understand when it is useful to use type properties! 10 minute delay Asynchronous Transition So we have replaced to tr...

RW.com: Animations Article - Part 1

Image
The run continues! Like I said, my plan is to absorb knowledge from these 'beginner' articles. I won't get ALL of it - there'll be stuff beyond me for sure. But there WILL be elements to glean from them, that's the point. In the past I've been too concerned with understanding every aspect but actually, it's more like gradually building a complex puzzle - one piece at a time! Start Time - 15:16 https://www.raywenderlich.com/5815412-getting-started-with-swiftui-animations *Article dated Dec 9th 2019 Again, this could well be over two parts. We'll see! The three key things we're going to learn are animation MODIFIERS and withAnimation - that's the function which lets you animate STATE CHANGES. And Custom Animations! Opened project - here are the various Swift files already put in! And here's what the view structure is - The app is to basically bring up info about the planets in the solar system. Basic Animations *subheading...

RW.com: Storyboards Segues Article - Consolidation

So, as mentioned, I need to consolidate this particular article. There was so much code there, I just wanted to look over it one more time and make sense of it all - from the Xcode project.  Start Time - 13:05 Let's look at one Swift File at a time. First of all the model - this is what was already created before the article: struct Player {   var name : String ?   var game : String ?   var rating : Int } A simple struct here. Name and game are optional because there may be no value (nil) put in - stops the program from crashing. Rating is an int - a score out of 5. That's interesting as anything could actually be set for it! The rating part wasn't actually covered in this project.  Now we have the view file: import UIKit class PlayerCell : UITableViewCell {      @IBOutlet weak var gameLabel : UILabel !   @IBOutlet weak var nameLabel : UILabel !   @IBOutlet weak var ratingIma...

RW.com: Storyboards Segues Article - Part 2

Image
Yes I'm back on the same day! One good thing about 'distancing' is having genuinely more time to code. Limiting in lots of other ways but every cloud and all that... So back on with the article - second and final part! Then a practical play around... Start Time - 13:20 Same article as before - https://www.raywenderlich.com/5055396-ios-storyboards-segues-and-more#toc-anchor-010 We're up to 'Selecting the Game' So for this, we have another 'unwind segue'. The exit bit now works after the game is selected, but nothing actually is selected. Here is what we're actually selecting. Right more fancy code added! Various bits about the GamePicker. Needing the identifier to match up to something or other. Again, I'm sure this is a lot easier in SwiftUI. This was specifically to get the checkmark in - if indexPath. row == gamesDataSource . selectedGameIndex {       cell. accessoryType = . checkmark     } else {       cell...