Index | Archives | Atom Feed

Reflecting changing state in SwiftUI Lists and List items

I was struggling with something recently in SwiftUI and thought I'd share the solution I came up with. Here's a simple example to demonstrate what I was stuck on:

struct ContentView: View {
  var tasks: [Task]

  var body: some View {
    List(self.tasks) { task in
      TaskView(task: task)
    }
  }
}

I have a List showing TaskViews made from Task models. Each TaskView includes a button which will set the task state to completed. When the user taps the button, a network call is kicked off, which changes the task's state on the server. When the network call completes (let's assume it succeeds …


My favourite iOS libraries

Over time I've developed a list of open-source iOS libraries that I use in almost all my projects. These are my favourite, go-to libraries:

TableKit

Declarative table views! I hate the boilerplate involved in UIKit table views and having to work with index paths to make sure you're acting on the right cell. With TableKit, you have a reference to the cell when you work with it, and most of the design and logic goes inside the cell subclass itself anyway. It's a much neater way to work.

PromiseKit

I struggled a lot to get my head around promises at …


Monthly Review: January 2020

I'm obsessed with

Social events! Early in the month I decided to double down on my goal of getting more social in 2020 and threw myself into a bunch of new social events and activities. The upsides were that I got a lot more exercise from being out and about more, which helped me sleep better, and I also found that string a lot of events together without big gaps in-between helped me capitalise on the buzz of each one to be more confident going into the next. On the other hand, it quickly became exhausting, and I felt like …


Monthly Review: December 2019

My review's a bit late this month—oops! I'm also experimenting with a different format since there's very little to my reviews normally. So let's start with a few things I've been into lately:

I'm obsessed with

Cooking! I'm watching Bon Appetit Test Kitchen videos all the time and I'm trying lots of new recipes. I'm feeling more confident about my ability to attempt different recipes or techniques, and haven't had any major disasters to put me off so far. I'm most excited about my efforts with dough of all kinds: brioche, ciabatta, pizza, breakfast biscuits, and croissants coming up …


Competing values

I've been thinking a lot lately about how personal values, interests, and hobbies often clash. Pick any value or interest you have and you'll probably find a group of people talking about it online. For most of my own average, mainstream, privileged interests, there are people on every social media platform talking about them, teaching others what they know, even trying to make money from others with the same interests.

But these communities tend to be very one-sided. They focus on the interest or value at the exclusion of all else. If you're selling courses, books, videos, or physical products …


2019 review

2018 review. All annual reviews.

(Side note: every year as soon as I publish my annual review, I start a new Markdown file for my review of the next year. Throughout the year I add achievements, details about goals I've accomplished, and favourite media, so getting the review ready to publish is much easier. I definitely recommend this approach!)

Here's a quick summary of 2019:

  • My main aim was to have fun and enjoy spending time with Josh. Having a puppy had added a lot of stress and tension to our lives, and though I still miss our dog a …

Thoughts on my 2019 learning project

I tried writing a couple of updates for my blog as I worked on my 2019 learning project, but once I'd written them they didn't seem worth sharing; there just wasn't a lot worth saying about the process. Now that I'm done, I wanted to share a few thoughts on how it went.

But first, a quick recap:

I wanted to try learning something new while I was on a break from work over the holidays. I decided to focus on web development, so my learning project consisted of:

  1. A reading list of articles and tutorials about HTTP, SSH, networking …

Learning Django in the holidays

Two years ago I learned Swift during the holiday break across Christmas and New Year's. I'd dabbled in Swift but had never really got my head around it (previously I'd taught myself Objective-C as my first ever programming language, and that was all I knew). I read Apple's official Swift book and a bunch of other books and articles, and finally it all seemed to click. I started writing some new code in Swift during that holiday period, and once I got back to work I started incorporating Swift into my work more and more. These days my main iOS …


Monthly Review: November 2019

November goals

✔️ 2 social events

I actually managed 3 social events. I didn't socialise a huge amount, but just showing up is important for me at this point, and practising socialising in small amounts will hopefully help me slowly become a bit less of a hermit.

✖️ Finish learning current song on the drums

The song I tried to learn was a bit too hard for me to play at tempo, so I didn't complete this. I did manage to learn to play a basic version of Livin on a Prayer by Bon Jovi, which is the first song I've been …


Monthly Review: October 2019

October goals

✖️ 1 dead hang chin up

I barely worked on this goal throughout the month. I've learned that I should pick physical goals that feel achievable, because this one felt a bit out-of-reach, and was no fun to work on, so I avoided it.

✖️ Learn to play The Phoenix by Fall Out Boy on drums

I can play through this song roughly, but I still need to work a lot on my timing, particularly during the chorus, which is quite tricky to play. I didn't focus heaps on this song throughout the month, because I got caught up in …

© Belle B. Cooper. Built using Pelican. Theme by Giulio Fidente on github, edited by Belle B. Cooper. Theme inspiration from Jordan Smith and DuoTone snow theme.