Posts

Showing posts with the label Intermediate Swift

Treehouse Intermediate Course - Part 19 (Build Interactive Story App Project 3)

Part 19! A good effort I'd say! I'm pleased to have stuck with Treehouse and to have no immediate need for moving on from it. Although it's several years out of date, compared to how the Swift language has evolved, it still seems relevant and more accessible than I thought. Anyway, not so good is my failure to get an entry in nearly a week. So today I'm getting in some, and will do so again tomorrow and/or Sunday. Back to the story app! Start Time - 12:17 Page Controllers A whole new section here! Right - something new! How to programme views... So a new Cocoa Class created - a subclass of view controller. Cool. Awesome! The VC connected from the segue before is now linked to the Page Controller subclass; it works because changed the background colour to blue, which came up when the start button was clicked. Nice. So getting more technical. We can make the page value an optional, but we don't want there to be the absence of a value. We don't want t...

Treehouse Intermediate Course - Part 18 (Build Interactive Story App Project 2)

Image
Back in Dubai and back to the code! I knew yesterday would be a right off. But just to clarify, I do NOT need to code every day. I reckon that 3-4 times a week for 30 minutes to 1 hour. That may not hit the self-imposed three hours a week target. Realistically, however, with school about to start again, I cannot guarantee three hours a week. I need to put together my long term plan for coding, which I will actually do below. I need more vision and purpose for it. Having faced several setbacks with it, I can't let that deter me. These may seem like random, unconnected thoughts but they do actually link together. So, before continuing with Treehouse, let's map out my long term plan! Step 1(June 2018-December 2018) - learn the basics syntax and principles of coding with Swift. Step 2 (January 2019 - June 2019) - learn more intermediate level coding and create several of my own projects. Step 3 (July 2019 to December 2019) - build on the intermediate concepts, learn some more...

Treehouse Intermediate Course - Part 17 (Build Interactive Story App Project 1)

So only around 20 minutes maximum today - just a brief entry. I didn't code yesterday as the time I'd spent on the F1 sim the day before had hurt my eyes and head too much! I'm heading back to Dubai today where I have my screen, so that will make it more doable! Anyway, time to start a new project! Let's go.  Start Time - 08:41 Intro I love the idea of these. As mentioned in the last blog, Angela had a fantastic one in her course before. The only issue with that was how 'messy' the code was for when the story would keep growing. This will involve building reusable views, navigating to a new view, and going back to the beginning when done. Taking in text, delegates, complex models...will hopefully be useful! Navigation Controllers  Modal views.... But we are using stack views. We have a view on top of another and so on. Navigation controller is provided by Xcode. Two jobs - 1. Present custom views from the view controller 2. Present its own custo...

Treehouse Intermediate Course - Part 16 (Delegation 3)

Image
Here we are now! So, first of all, I've spent several hours tinkering with the F1 Sim Playground and made some major breakthroughs! Yesterday, I realised that the main issue was that the random value was being added to ALL the drivers' distanceTravelled. This basically negated the whole point of the random element. Essentially, the maxSpeed would determine the whole race! So I came up with a solution...eventually! And I am so proud of it! I can now run a sim for a general race for as many drivers as I want, all with their own maxSpeed set, and the results are randomised, but based mostly on what their maxSpeed is. Cool! Unfortunately, today, I have been battling with trying to run the overall results. I tried it as a for loop, as a closure...a function...and I've had to give up! Always frustrating...actually kind of heart-breaking but that's where resilience needs to come in. So easy to feel disappointed but this is where I need to get more ruthless. I don't have ...

Treehouse Intermediate Course - Part 15 (Delegation 2)

So there just wasn't a chance yesterday to code! But I'm back today. I was thinking more about creating my own little programme to simulate F1 races and still love that. It could be extended to cricket - a ball by ball approach! But that's something for another time. For now, I'm going to complete this section on delegation; once the race horse example is done, THEN I'm going to play around with the code to see how the F1 sim could work! Cool. Start Time - 08:58 Implementing A Delegate So we need to get any object to adhere to a particular contract, to loosely communicate with race...sounds complex but we're going to find out more! Right so this is the example. This is the delegate - protocol HorseRaceDelegate {          func race( _ race: Race , didStartAt time: Date )     func addLapLeader(forLap lap: Int , atTime time: Date )     func race( _ race: Race , didEndAt time: Date , withWinner winner: Horse ) } De...