惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
T
Threatpost
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
D
Docker
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
The GitHub Blog
The GitHub Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
T
Troy Hunt's Blog
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
量子位
Apple Machine Learning Research
Apple Machine Learning Research
H
Help Net Security
F
Full Disclosure
B
Blog
O
OpenAI News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
Forbes - Security
Forbes - Security
Know Your Adversary
Know Your Adversary
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
Scott Helme
Scott Helme
T
The Exploit Database - CXSecurity.com
博客园 - 聂微东
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
Recorded Future
Recorded Future
IT之家
IT之家
Project Zero
Project Zero
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
SecWiki News
SecWiki News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

alexwlchan’s notes

Managing the caption of a photo with AppleScript (but not PhotoKit) Goodhart’s and Campbell’s Law are different Notes from The Cornishman No. 176 (Spring 2026) Notes from The Cornishman No. 176 (Spring 2026) GitUp can’t diff text files larger than 8MB Home Testing the width of a page on a mobile device using Playwright Disable AirPods charging notifications Start a Caddy server in a subprocess during a Python session Filter a list of JSON object based on a list of tags HOME_GET_ME_HOME is a Citymapper Shortcuts action The FileExistsError exception exposes a filename attribute The red-lined bubble snail Why can’t Python connect to example.com? Useful type hints for Python How to truncate the middle of long command output AirPlay Receiver can interfere with Flask apps What’s the main prefix in SQLite queries? The file(1) command can read SQLite databases My randline project is tested by Crater Road signs in the Soviet union don’t have circular heads Setting up golink in my personal tailnet Create a file atomically in Go Get a map of IP addresses for devices in my tailnet The SQLite command line shell will count your unclosed parentheses Use SQL triggers to prevent overwriting a value Testing date formatting with date-fns-tz and different timezones The “strangler” pattern is named after a tree, not an act of violence Place with the same name, but different etymology
Drawing an image with Liquid Glass using SwiftUI Previews
2026-03-07 · via alexwlchan’s notes

I used Xcode to create an image with a Liquid Glass effect, then I used the Preview to export it as a standalone file.

Earlier this week Apple announced a “new” Studio Display which is almost the same as the previous Studio Display, only gaining a better camera and Thunderbolt 5.

Jack Wellborn posted an image on Mastodon joking about the lack of new features – one of Apple’s marketing images overlaid with a blue “new” banner in the corner, which is how Apple’s online store used to highlight new products. The Accidental Tech Podcast used a similar image as their artwork and favicon for years, joking about the lack of updates to the Mac Pro.

I wanted to create a similar image with a “new” banner in the style of Liquid Glass, to make fun of the design problems in macOS Tahoe. Initially I tried creating it in Acorn, but I lack the graphical design skills to replicate the effect – I realised it would be easier to create the effect in code.

I opened Xcode on a Mac running macOS Tahoe and created a new Mac app. I added one of Apple’s marketing images to the Asset catalogue, then I modified the default SwiftUI view ContentView:

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Image("center_stage_hw_studio_display__f0h1yn012iie_large_2x")
                .imageScale(.small)
                .foregroundStyle(.tint)
                .overlay(alignment: .topTrailing) {
                    Text("NEW")
                        .font(.title)
                        .foregroundColor(.white)
                        .padding()
                        .frame(width:400, height:5)
                        .glassEffect(.clear, in: Rectangle())
                        .offset(x:150,y:-150)
                        .rotationEffect(.degrees(45))
                        .overlay(alignment: .bottom) {
                            Text("NEW")
                                .font(.system(size: 120))
                                .foregroundColor(.white)
                                .rotationEffect(.degrees(45))
                                .offset(x:-25, y:300)
                                .blur(radius: 1.5)
                                .opacity(0.7)
                        }
                }
                .clipped()
        }
        .padding()
    }
}

#Preview {
    ContentView()
}

I ran Xcode with two panes: my source code on the left, my preview on the right. That worked well for iterating the design, because I could tweak the source code and immediately see the effect.

Even with my limited SwiftUI experience, I know this isn’t very good – for example, I have two Text views, because I couldn’t make the first one work. (Specifically, I couldn’t make it work with glassEffect and rotationEffect – the text was rotated within a horizontal glass container.)

I also couldn’t get the banner to be a thin rectangle; I ended up drawing a large rectangle that clips out of the view (clipped()) and overlaps the entire corner. Let’s retcon that as an homage to the way Tahoe’s UI supposedly “gets out of your way”, but actually takes over even more of your screen.

Rubbish as this code is, it does the trick! And I discovered that Xcode has a menu item to export the SwiftUI Preview as an image: Editor > Canvas > Export Preview Screenshot. I was using Xcode 26; I imagine that menu item might move around in different versions.

Here’s what the output looks like:

A photo of a large display with a glassy triangle in the top right-hand corner which has the word 'New' shown in blurry, barely-visible text.

I don’t expect to create more images like this, but it’s cool to know I could use Xcode to mock up UI or Liquid Glass quickly, and export my work as images.