Sign in

Stephan Schlecht

@sw7com.bsky.social
282 followers 1.1K following 386 posts

Software developer, mainly iOS and macOS.

PostsRepliesMedia
Stephan Schlecht @sw7com.bsky.social · 05/10/2026
Was planning to do this eventually anyway: Added LSP support to my editor.
Go program in editor showing gopls hint.
000
Stephan Schlecht @sw7com.bsky.social · 02/10/2026
Maybe better to see in a small example.
This image shows a side-by-side comparison of a simple program written in Go (left) and C (right) that processes a list of optional strings. Both versions implement a describe function to handle three cases: a null pointer (returning "unknown"), an empty string (returning "none"), and a valid string. The terminal output demonstrates that both languages produce the identical result when iterating through the provided test cases.
100
Stephan Schlecht @sw7com.bsky.social · 02/10/2026
In Go programs, you will occasionally find a helper function like this, especially in unit tests, where you often want to define a pointer to a literal. The reason is that the address operator & requires an addressable operand (e.g. a variable). See also go.dev/ref/spec#Add...
func ptr[T any](v T) *T {
	return &v
}
100
Stephan Schlecht @sw7com.bsky.social · 02/10/2026
Sometimes I have thoughts like, 'I'm glad I went with a custom UIView since it made placing the gutter icons/markers easier,' only to realize a few minutes later that an NSRulerView subview would've done the job just as well.
An image shows a code editor window displaying a Go program with two orange arrows pointing to highlight blue circular gutter icons, which typically indicate breakpoints for debugging.
030
Stephan Schlecht @sw7com.bsky.social · 13/09/2026
Saw some computers at a museum of applied arts today, including a Robotron A 5120. It's an 8-bit computer from 1982 (up to 64 KB) that cost between 27,000 and 40,000 East German Marks.
The two photos show the exhibit displayed on white surfaces. The top photo shows the beige Robotron A 5120 unit: a CRT monitor on the left, logo panel in the center, and three floppy drives on the right. The bottom photo shows its keyboard: round black keys, white function keys, and a red-and-green keypad cluster.
020
Stephan Schlecht @sw7com.bsky.social · 10/09/2026
The Macintosh IIfx used a 68030 chip. I found a cool browser emulator running System 7 that even features a Metrowerks C compiler. I've never seen one in real life, but according to Wikipedia, its original intro price would be equivalent to $22K today. infinitemac.org/1991/System%...
Screenshot shows an emulated Mac IIfx with System 7 in the browser, with CodeWarrior and a one‑line C program that prints "Good morning, Bluesky", compiled it into newproj.A. A window with the segment table is shown as well. The About This Macintosh box confirms the vintage hardware/OS underneath.
210
Stephan Schlecht @sw7com.bsky.social · 09/09/2026
I've got it bookmarked in my Finder sidebar. Don't even have to open Xcode to wipe the folder.
Screenshot showing the DerivedData folder item a favorite in the Finder sidebar.
011
Stephan Schlecht @sw7com.bsky.social · 09/09/2026
Almost forgot: here is a workaround. It might not be the most elegant solution, but it's what I use.
    
    endScrollObserver = NotificationCenter.default.addObserver(
        forName: NSScrollView.didEndLiveScrollNotification,
        object: scrollView,
        queue: .main
    ) { [weak scrollView] _ in
        MainActor.assumeIsolated {
            scrollView?.flashScrollers()
        }
    }
000
Stephan Schlecht @sw7com.bsky.social · 06/09/2026
Ha, ha. Indeed. I'd recommend to start with LM Studio (nice chat UI), an MoE model like qwen/qwen3.6-35b-a3b with 4-bit quantization, and a customized /.config/opencode/opencode.jsonc file.
{
	"$schema": "https://opencode.ai/config.json",
	"provider": {
		"lmstudio": {
			"name": "LM Studio (local)",
			"npm": "@ai-sdk/openai-compatible",
			"options": {
				"baseURL": "http://localhost:1234/v1"
			},
			"models": {
				"lmstudio/qwen/qwen3.6-35b-a3b": {},
				"lmstudio/google/gemma-4-31b-qat": {},
				"lmstudio/qwen/qwen3.8-27b": {}
			}
		}
	}
}
000
Stephan Schlecht @sw7com.bsky.social · 05/09/2026
I've set up an Amiga 4000 emulator (FS-UAE) and I'm just tinkering with it a bit. Emulators definitely have their own charm.
A screenshot of the Amiga emulator: you can see a text editor and a shell where I compiled a simple GUI alert using vbcc (which threw a warning), along with a couple of other open windows.
130
Stephan Schlecht @sw7com.bsky.social · 04/09/2026
We had a visit from two common kestrels (Turmfalken).
Two common kestrels sitting on a fruit tree.
000
Stephan Schlecht @sw7com.bsky.social · 01/09/2026
Been tinkering with various things here and there, for fun and to learn. A few years ago, I built this (using SwiftUI for the first time). It might come in handy, as I’d like to switch my password manager for recent reasons (ofc no proprietary crypto, it uses KeePass file format).
Screenshot shows a simple three-pane layout app: a category sidebar on the left, a searchable entry list in the middle, and a detail view on the right. Its clean dark theme and minimal controls keep the focus entirely on the stored data. There is only one example entry.
030
Stephan Schlecht @sw7com.bsky.social · 21/08/2026
Started taking a look at SwiftTerm: seems to use Metal on macOS. Wasn't necessarily expecting that. Interesting. Maybe because of scrolling performance? Or smooth resizing? I'll see.
This screenshot shows the Metal shader code for SwiftTerm on GitHub, specifically the fragment function used to render terminal text by sampling a texture atlas.
110
Stephan Schlecht @sw7com.bsky.social · 21/08/2026
Ok, so it's decided: the bar without the X it is (since it's non-modal, it shouldn't get in the way anyway.) Thx.
Screenshot showing a editor displaying a Swift file with a persistent amber warning notification bar at the top stating that the file has changed on disk, which lacks a close button (x) and instead offers only "Revert" or "Keep My Version" options.
010
Stephan Schlecht @sw7com.bsky.social · 21/08/2026
Should be done with the conflict handling, but I’m second-guessing the UI. The 'x' feels ambiguous, would it be better to just use 'Revert' and 'Keep My Version'? Also, would 'Reload from Disk' be clearer than 'Revert'? Oh, and the red tint seems a bit too subtle, should it be made more neon?
A screenshot of an editor in development with a file conflict notification bar: thin, horizontal alert bar spans the top of the editing area. It has a very subtle red/pink background tint. Three buttons are on the right side of the bar: "Revert" and "Keep My Version" and  a small "x" (close/dismiss button). A bright red arrow annotation is pointing directly at this "x".
110
Stephan Schlecht @sw7com.bsky.social · 20/08/2026
While we're on the subject: passing this struct as inout into a function would also be a bad idea, because you'd be violating Swift's Law of Exclusivity.
The code snippet displays a Swift code snippet using AppKit where red arrows highlight an inout parameter and its subsequent usage, illustrating a scenario that violates Swift's Law of Exclusivity.

 import AppKit


struct DisplayImage {
    let imageRep: NSBitmapImageRep
}

class ViewController: NSViewController {
    private var displayImage: DisplayImage!
    private var displayImage2: DisplayImage!

    //...
    
    displayImage = DisplayImage(imageRep: Self.makeCircleBitmap())
    displayImage2 = displayImage
    
    // MARK: - Private

  
    @objc private func onInvertTapped() {
        invert(displayImage: &displayImage)
    }
    
    @objc private func onInvertTapped2() {
        invert(displayImage: &displayImage2)
    }
    
    private func invert(displayImage: inout DisplayImage) {
        displayImage.imageRep.invertInPlace()
        updateImages()
    }

    private func updateImages() {
        imageView.image = Self.nsImage(from: displayImage.imageRep)
        imageView2.image = Self.nsImage(from: displayImage2.imageRep)
    }
000
Stephan Schlecht @sw7com.bsky.social · 19/08/2026
That's why you should avoid using reference types in structs. When assigning a value type, you expect to get an independent copy. That's not the case in this example. The invert action inverts both, since it's just a single NSBitmapImageRep that's referenced twice.
This code snippet demonstrates a common pitfall in Swift: how structs behave when they contain reference types.

import AppKit


struct DisplayImage {
    let imageRep: NSBitmapImageRep
}

class ViewController: NSViewController {
    private var displayImage: DisplayImage!
    private var displayImage2: DisplayImage!

    //...
    
    displayImage = DisplayImage(imageRep: Self.makeCircleBitmap())
    displayImage2 = displayImage
    
    // MARK: - Private

	 @objc private func onInvertTapped() {
        displayImage.imageRep.invertInPlace()
        updateImages()
    }
    
    private func updateImages() {
        imageView.image = Self.nsImage(from: displayImage.imageRep)
        imageView2.image = Self.nsImage(from: displayImage2.imageRep)
    }
210
Stephan Schlecht @sw7com.bsky.social · 17/08/2026
With my JetBrains IDE subscription, I get some AI credits automatically. I have a few days left to use them before they expire. What USEFUL things could I do with them without sending existing code to a US company? I'm open to suggestions.
Screenshot of JetBrain's "AI Assistant" settings. It displays credit usage, showing 19.75 / 20.00 monthly credits used and mentions it renews on 26.08.26, so in a couple of days.
010
Stephan Schlecht @sw7com.bsky.social · 15/08/2026
I know this is a bit messy (I'm working on it), but error messages like this in Xcode always confuse me. Turns out I just misspelled 'drafts:'.
The screenshot shows a snippet of Swift code in Xcode where the user misspelled the parameter drafts: as defats:. While the dev is focused on a different error message at the top regarding a nil return value, the red arrow points to the actual typo on line 116. This highlights how confusing Xcode errors can be, as the compiler often reports a problem in one place when the root cause is a simple typo elsewhere. Xcode's error message reads: "'nil' is not compatible with closure result type 'TabState'"
031
Stephan Schlecht @sw7com.bsky.social · 14/08/2026
forEach is marked as mutating. body closure calls reg.remove(). This would require exclusive access. Crashes in debug build configuration, maybe author didn't notice because they only used the release config, can't say for sure.
110
Stephan Schlecht @sw7com.bsky.social · 14/08/2026
Adding snapshotting here still violates Swift's Law of Exclusivity github.com/swiftlang/sw....

struct IntRegistry {
    
    private var entries = [1: "a", 2: "b"]

    mutating func remove() { entries.removeValue(forKey: 1) }

    mutating func forEach(_ body: (Int) -> Void) {
        let snapshot = Array(entries.keys)
        for k in snapshot { body(k) }
    }
    
}


var reg = IntRegistry()
reg.forEach { k in
   if k == 1 { reg.remove() }
}
print("this is the end of everything")
231
Stephan Schlecht @sw7com.bsky.social · 12/08/2026
I don't really like the title 'Draft in Current Window', need to let it sit and think about it again tonight.
There is a macOS screenshot of a tool in development showing the 'New' submenu, where the entry 'Draft in Current Window' is selected in blue."
000
Stephan Schlecht @sw7com.bsky.social · 11/08/2026
Don't know. Read this morning, that China can continue to reduce its crude oil imports for another six months without any problems: www.wsj.com/business/ene...
WSJ screenshot of China's oil stockpile.
020
Stephan Schlecht @sw7com.bsky.social · 11/08/2026
That’s kind of how it is right now, isn't it? At least according to data from openrouter.
The screenshot shows data from the openrouter ranking, which indicates that the most commonly used models are, in fact, open-weight Chinese models.
010
Stephan Schlecht @sw7com.bsky.social · 04/08/2026
Whoa, a few days ago I read that the damage would be at $40 million, and now it's already $70 millions? Let's see what the situation looks like next week...
Post from 31 Jul 2026 about $40 million worth of Bitcoin stolen
100
Stephan Schlecht @sw7com.bsky.social · 30/07/2026
Lol. With "marketing" emails like these, you can be absolutely absolutely certain reach devs who definitely won't unsubscribe, will definitely read the article, and will 100% buy your products. What? 🤷
AI slop.
000
Stephan Schlecht @sw7com.bsky.social · 29/07/2026
I forgot temporary attributes exist and was trying to clear temporary attributes using setAttributes. Time to call it a day.
Apple documentation about setTemporaryAttributes
000
Stephan Schlecht @sw7com.bsky.social · 29/07/2026
Even if I restrict opening the same folder twice later, it's a good way to test the sync, like syncing changes, undo manager binding to different NSTextViews, updating word-wrap in one doc updating all views, etc.
010
Stephan Schlecht @sw7com.bsky.social · 28/07/2026
For some reason, opinions on this seem to change every now and then. 🤷
WSJ headline: “Big Companies Are Starting to Hire Again, Defying Predictions of AI Wipeout” with sub headline: “After a year of holding back on new hires, companies from tech and transportation to defense now say they need more people to work alongside AI”
011
Stephan Schlecht @sw7com.bsky.social · 25/07/2026
Couldn't resist. Undo for drafts is now persisted across app restarts. Nice side effect: proves undo/redo doesn't rely on concrete object instances.
122
Stephan Schlecht @sw7com.bsky.social · 22/07/2026
I was just playing around a bit; needed o run a quick test to see if a certain menu item is added by system. Much better than `swift -e ‘...’ 2>&1` on the command line for sure. (do not know where the title "Silken Couragenus" comes from, I don't even know what a "Couragenus" is.)
The IDE screenshot shows that, by default, a TextView context menu item contains only the specified elements (`super` not called -> kind of expected), specifically, it does not include an AutoFill menu entry.
120
Stephan Schlecht @sw7com.bsky.social · 22/07/2026
And I thought one could disable this automatic submenu entry with setting isAutomaticTextReplacementEnabled to false. Hmm.
The screenshot shows a submenu with the automatically added menu item “AutoFill.”
000
Stephan Schlecht @sw7com.bsky.social · 20/07/2026
After not working on it for two weeks, I'm back now and thinking about what I'd like to display under “Reveal in Sidebar” for unsaved drafts. Maybe a “Drafts” section?. Hmm.
021
Stephan Schlecht @sw7com.bsky.social · 16/07/2026
Dreiviertelblut live!
The picture shows a stage with the musicians from the band Dreiviertelblut
100
Stephan Schlecht @sw7com.bsky.social · 03/07/2026
That feeling when you're drilling down in Instruments to find the bottleneck, that strange mix of satisfaction at having found it and embarrassment because you really should have known about it in the first place.
This screenshot shows a drill-down in the macOS Instruments profiling tool leading to a hotspot.
130
Stephan Schlecht @sw7com.bsky.social · 01/07/2026
It rained in Regensburg tonight, finally some cooling.
010
Stephan Schlecht @sw7com.bsky.social · 27/06/2026
I like seeing that in a library 100%
Github screenshot: Languages: Swift 100%.
010
Stephan Schlecht @sw7com.bsky.social · 24/06/2026
I think about things like that.
020
Stephan Schlecht @sw7com.bsky.social · 13/06/2026
Just saw the use of `data[...]` in some code, where `data` is of type `Data`. That got me thinking: if the SubSequence type of a collection matches the type of the collection itself, using the unbounded range operator (`...`) makes no difference. github.com/swiftlang/sw...
The code
```
import Foundation

let data = Data([1, 2, 3])
let whole = data[...]

print("data type:", type(of: data))
print("data[...] type:", type(of: whole))
print("same value:", data == whole)
```

gives the result

```
data type: Data
data[...] type: Data
same value: true
```
120
Stephan Schlecht @sw7com.bsky.social · 12/06/2026
Installed Golden Gate beta and Xcode beta in UTM and, of course, immediately compiled my GitChronicles app: at first glance, everything seemed to work right away, at least so far.
Screenshot showing the beta version of macOS Golden Gate running the beta version of Xcode and the GitChronicles app.
010
Stephan Schlecht @sw7com.bsky.social · 12/06/2026
I got it working on Tahoe in UTM (App Store version) by first installing Tahoe IPSW as a guest and then installing Golden Gate Beta with InstallAssistant.pkg as an update within the guest. I don't know yet how well it works; I haven't had much time to try it out.
Screenshot shows macOS Golden Gate beta inside UTM on macOS Tahoe. The About This Mac dialog of the guest OS shows macOS 27.0.
000
Stephan Schlecht @sw7com.bsky.social · 10/06/2026
So you can restore a bricked Intel MacBook Pro using DFU (Device Firmware Update) from a Silicon MacBook. That's pretty cool. All you need is a USB-C-to-USB-C cable. Hopefully the rest will work out too.
Screenshot with Apple Configurator in DFU mode showing a progress bar: "Restoring System on device."
232
Stephan Schlecht @sw7com.bsky.social · 07/06/2026
Lol. Too bad it's a Snow Leopard bug fix update and not a Tiger one; otherwise, I could just install it.
The image shows an old 17-inch Apple Studio Display, as it was typically shipped with a PowerMac G4 Cube. In the "About" dialog, you can see that Mac OS X version 10.4.6 (Tiger) is installed.
110
Stephan Schlecht @sw7com.bsky.social · 07/06/2026
Very nice. We had a visitor. A Green Woodpecker (Grünspecht) perched in the cherry tree in the garden.
A Green Woodpecker is sitting on a branch in the cherry tree.
010
Stephan Schlecht @sw7com.bsky.social · 28/05/2026
I saw a green lizard today. It's a very beautiful animal.
The photo shows a beautiful green lizard.
010
Stephan Schlecht @sw7com.bsky.social · 24/05/2026
Saw a Rose-ringed Parakeet (Halsbandsittich) today.
The photo shows a Rose-ringed Parakeet on the ground. The bird's vivid green plumage and red beak stand out clearly against the ground.
010
Stephan Schlecht @sw7com.bsky.social · 19/05/2026
I'm thinking about using a minimalist interface for the title bar. Aside from the fact that the opacity of the line number gutter isn't reduced (can be fixed for sure), I'm not yet sure if that's really what I want. I need to think about it some more tonight.
Screenshot where the content expands below the title bar. The content below the title bar is slightly transparent, but the document name and editable state is also visible, allowing you to save the file just as you would in Edit. No transparency is applied to the line number bar on the left, which is a bug.
030
Stephan Schlecht @sw7com.bsky.social · 15/05/2026
In TextKit 2, if you only change the rendering attributes for ranges, the update either doesn’t happen at all or only occurs after a while, once you’ve scrolled a bit. One workaround I’ve found is to call setNeedsDisplay for the (sub)layers of the subviews, but there must be a better way, no?
The screenshot shows a test screen with Lorem Ipsum text, with each line of text displayed in the colors of the rainbow palette.
140
Stephan Schlecht @sw7com.bsky.social · 14/05/2026
Hmm, the graphs showing the changes look pretty dramatic.
010
Stephan Schlecht @sw7com.bsky.social · 14/05/2026
Gray Heron waiting for the train?
The photo shows a gray heron standing in front of train tracks, looking to the left as if it were waiting for a train
010