Changing the Direction of a SwiftUI Color Gradient

SwiftUI added a pretty cool new property to Color to easily create subtle gradients.

Rectangle().fill(.blue.gradient)

Now, all colors, even custom colors, come with a standard gradient. The problem is that the gradients all go top to bottom. I submitted feedback to allow changing the direction, but, turns out, there’s already a way! You can use new ShapeStyle functions to create gradients using a color’s standard gradient. For example:

Text("Hello, World!")
    .foregroundStyle(.linearGradient(Color.orange.gradient, startPoint: .leading, endPoint: .trailing))
    
Rectangle()
    .fill(.radialGradient(Color.cyan.gradient, center: .center, startRadius: 0, endRadius: 500))

I like the new standard gradients. They even work with custom colors, like Color(red: 91/255, green: 140/255, blue: 90/255).gradient. And I’m glad you can derive new gradients from them with ShapeStyle—adds a lot more possibilities.

Wwdc 2022 Wishlist

Here’s some things I’m hoping for this year at WWDC:

  • Multiple user support in iPadOS.
  • Password sharing.
    • My wife and I share passwords for various accounts. This is what keeps us on 1Password.
  • Interactive widgets.
    • Along with more reliable widget updates.
  • Not having to restart my computer and iPhone to get Xcode to run an app on my device.
  • No more endlessly preparing watch for development in Xcode.
  • Big SwiftUI updates.
    • I love SwiftUI, but I can’t do everything in it yet. Any specifics I list would be subject to recency bias. So, I’ll just say breaking out of the mold in SwiftUI can be really painful and I would like it to not be painful.
  • Whatever Marco Arment needs on watchOS to make downloads reliable and fast in Overcast.

That’s what came to mind to me in the last 5 minutes or so. Overall, I like using Apple platforms and I enjoy developing for them. I’m excited to see what will be announced at WWDC.

My Supposed Dream Job

I think that my dream job would be an indie developer. But I’m not sure. I wish I could try it.

I don’t have enough money saved up to just quit my job and give it a go. I also don’t feel like I have enough energy to put in a real effort to make it work in my free time. And, maybe a bigger problem, I haven’t had an idea that I think could be financially sustainable long term.

Also, history has also shown that I tend to burn out on something as soon as people start using it. Maybe I would feel differently if it were my full time job.

Maybe this all just means that I don’t want it enough; that I’m not willing to take the risks. People who really want something make it happen right? That’s at least how the story goes. Could also be that it’s just not the right time and I need to be patient, save money, and wait for the right idea. Or if I really do want it, really put in the effort to make it work in my free time until I can my it my full time job. All of these sound quite daunting.

It’s hard thinking I know what I want, but equally unsure if that’s actually what I want and how to make it happen. I’m 30 now. Feels like I should know what I want by now. But I’ll keep trying to figure it out.

Re: Rss

Chris Coyier blogged about RSS. Talking about how RSS can be social, he wrote:

How is all this social? It’s just slow social. If you want to respond to me, publish something linking to what I said. If I want to respond to you, I publish something linking to what you wrote.

Slow social.” I liked this. So, I guess instead of tapping a heart, I’m blogging about it.

RSS feels slow and deliberate. I’ve been thinking about being more deliberate in my life, so I like that idea. Not sure I have much more to say about RSS right now, but I wonder what else can be done with it. I like Twitter mentions and replies. I think IndieWeb and services like micro.blog can support this, but honestly I need to learn more about those and how they work.

RSS is cool though. I enjoy finding blogs to subscribe to.

Go One Level Deeper

When I was in college, I was a teaching assistant in a computer science class. A lot of our job was helping students read errors. Your program won’t run for no reason? Any errors in the output? No? What about this null pointer exception here? Take a look at that line.” Sometimes putting in a little bit more effort to go another level deeper is all that’s needed to figure out what’s going on.

I’ve tried to keep that in mind throughout my career. When I come across an error, I try to go one level deeper. Page won’t load? Open the dev tools. What does the error message say? Go to that file. Data isn’t coming back the way I expect? Look at the server code. Third-party library doing something unexpected? Dig through their code on GitHub. Don’t understand what someone did in the function? Talk to them. Don’t just read the first StackOverflow result and give up, read a bunch, and then go find blog posts about it.

So that’s my advice, keep going one level deeper, and you’ll learn a lot. Not everyone does this, and it kind of feels like having a super power when you do. Instead of the being the one always pinging others with problems, you’ll be the one who can solve those problems. Over time, you’ll become an expert.

My New Favorite Font

The YouTube algorithm got me today and suggested a video about a font called Comic Code by Toshi Omagari. I was immediately intrigued. As I was just about to buy it, I decided to look around a bit. I stumbled upon Codelia, also by Omagari. It was love at first sight. Codelia has a similar feel of softness the Comic Code does, while feeling a little more professional and refined. It was on sale and I bought it.

Picture of Sam Warnick

As my daughter says, I'm just a tired dad, with a tired name, Sam Warnick. I'm a software developer in Beaufort, SC.

Some things I do