Category: blog | 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 …


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 16" MacBook Pro

I recently wrote about the 2019 15" MacBook Pro I bought and how I was finding it. A very high-level summary: the keyboard was okay, I hated the TouchBar, and the bluetooth was awful.

When the 16" MacBook Pro was announced recently, my 15" was less than two months old, so I was able to talk Apple into letting me return it so I could buy the 16". I'm really lucky—lots of people who'd had theirs a little longer than me weren't able to get a return, and after trying the 16" I'm extremely glad I didn't have to …


2019 MacBook Pro

In 2015 I bought a used, mid-2013, 15" retina MacBook Pro. I was upgrading from a 13" MacBook Air, which was feeling cramped as I was spending more time on development than writing.

My MBP served me well until 2019. Its battery life had declined over time, but a few months ago it started going to sleep when the battery indicator still said 15% or more. I was getting around an hour of battery life out of it, but because the battery indicator wasn't accurate, I had no idea when it would suddenly go to sleep while I was working …


Ways I've reduced waste in my life

Although I'd like to get better at this still, I've made some changes over the past year or two to decrease how much waste I create. Mostly this means finding reusable alternatives to disposable items I use often, and avoiding unrecyclable plastic when I can.

In case they inspire you to make a change too, here are some of the things I've changed so far.

Metal straws

I don't use straws too often, but often enough that I had a packet of plastic, disposable straws in the pantry. I replaced those with metal straws that I can wash, and which …


My favourite personal blogs: 2019 edition

I keep saying I'd like to blog more but being out of the habit means I'm lacking ideas. (Having ideas often prompts more of the same.) So, to get back into the habit, I've been browsing my own blog's archives, and writing updated versions of old posts, like my "Stuff I like" posts. This one is a collection of some of my favourite personal blogs. I'm happy to say the current list includes more women than last time (the original list was 100% male).

AnomaLily.net

Like some of my other favourite blogs, I primarily read this one for the …


Stuff I like: 2019 edition

I've written a couple of posts in the past about physical items I enjoy using. Since the last one was in 2016, here's a list of stuff I've been enjoying more recently (no affiliate links):

Brita fill&go Active water bottle

I have very specific tastes when it comes to water bottles. These days the kind with flip tops are all the rage, but I like a pop top that I can open and close with my mouth, so I can drink one-handed. Although pop-top bottles still exist, they often have very sturdy rubber tops that take too much effort …


Declarative iOS layout with Panda

For the first time in a few years, something I'm super excited about was announced at WWDC. I can't wait to get my hands on SwiftUI and try it out in a real project. I'm concerned about how well it will work on custom, complicated layouts, but I'm still excited to give it a go. And how much more productive will we be with live reloading?! I know this has technically been possible in the past, but I've never managed to get it working, so I'm looking forward to trying it when it's easier to work with.

A quick look …


2019 mid-year review

I save all my favourite moments and media for my end of year review, so this is just a quick check-in on my goals to see how I'm going and whether I need to adjust my priorities for the second half of the year.

Let's look at the goals I set for 2019 in January:

Finish Drawabox

Well, this is not going to happen. Actually, the person who runs Drawabox says not to set a goal like this, because you don't want to rush through it and tick it off, but take your time and learn. This seems fair. I'm …

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