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

推荐订阅源

Project Zero
Project Zero
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
Visual Studio Blog
爱范儿
爱范儿
P
Proofpoint News Feed
F
Fortinet All Blogs
雷峰网
雷峰网
小众软件
小众软件
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
S
Security @ Cisco Blogs
Help Net Security
Help Net Security
GbyAI
GbyAI
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog
B
Blog
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
H
Heimdal Security Blog
Google Online Security Blog
Google Online Security Blog
S
Security Affairs
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Help Net Security
O
OpenAI News
H
Hacker News: Front Page
博客园 - 叶小钗
Last Week in AI
Last Week in AI
S
Schneier on Security
The Last Watchdog
The Last Watchdog
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
MyScale Blog
MyScale Blog
Recorded Future
Recorded Future
博客园 - 【当耐特】
V
Vulnerabilities – Threatpost
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
The Hacker News
The Hacker News
A
Arctic Wolf

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.