Tag: 100daysofswiftui

  • Rock, Paper, Scissors (1)

    As I mentioned yesterday, I needed to make some progress to blog about, and I had a half working version of a Rock, Paper, Scissors for Day 25 so I pushed myself to get that working. There’s lots in the code below I don’t love. source on github

  • .self in ForEach

    I’m on Day 25 of Hacking With SwiftUI, and Paul is making a point about how SwiftUI can loop over an array to build a view. He starts with this: But then proposes an alternative: He explains the use of \.self here by saying So, we come back to how Swift can identify values in…

  • Project 3

    This one’s not really a project, just a couple of little updates to earlier work, and a code snippet. Challenge 1 Go back to project 1 and use a conditional modifier to change the total amount text view to red if the user selects a 0% tip. The first one is pretty simple – a…

  • Day 23 – Views and Modifiers – Part 4

    Then the last trick for for decomposing the views, is to remember we can pass values when we init a struct. So something like this: This is probably my favourite – because although in this example I’ve created the mini-view struct in the body, if it’s a building block I can use elsewhere in a…

  • Day 23 – Views and Modifiers – Part 3

    The next part of day 23 started to make my brain hurt a bit. It’s easy to imagine that when presenting a complex screen – perhaps some data from a source as a mixture of images and text loaded from a database into a scroll-able view, that the view may start to get complex. Then…

  • Day 23 – Views and Modifiers – Part 2

    Although “immutable” the view structs can contain some control statements such as if/then and for loops. So this is quite legal, and useful. But Paul cautions against this, saying: You can often use regular if conditions to return different views based on some state, but this actually creates more work for SwiftUI – rather than…

  • Day 23 – Views and Modifiers – Part 1

    I found this one of the trickier days, so I’ll write it out to clear up my thinking. To draw to to screen in SwiftUI, we don’t call a command to draw on a canvas or window. Rather, a view is defined as an immutable struct of type some View. Here’s the simple one from…

  • Project 2 – Guess the Flag

    Another 100 Days project – the second tutorial one. This was once again a “V” design pattern (put everything in the view) and as I kept growing it, especially in the challenges, I had a growing sense of unease. New things for me was how image assets work – identifying them with strings is convenient,…

  • Challenge 1

    I’m up to Challenge 1 of 100 Days of SwiftUI (Day 19) which is to make your own simple (no MVVM) version of the app built in the previous three days. It’s about as simple as can be whilst still feeling like a real app. Something I hadn’t done before was limiting the keyboard to…

  • $==Commitment

    Paul Hudson’s 100 Days of Swift UI course is free – the videos are on YouTube, all the reading and tasks are available on his website for free. Although I assumed he made his living from the prodigious number of Swift books he’s written, he doesn’t push them in the course (except for his free…