Maybe you have some old code (you wouldn’t write this nowadays, of course) that uses someValue is SomeType checks. Maybe you need to check if someValue is a generic type, like the following Box: Then your is predicates won’t work: The good news is that since you treat the concrete type as a mere marker, you can express this condition with a type marker protocol:
I never saw usage of a typealias Dependencies declaration that uses Protocol Composition to declare which dependencies are needed (expressed as 1 type being the combination of all actual dependencies).
This was news to me, so I wonder if you ran into something like this out there in the wild.
Sven Schmidt alerted me to the fact that you can check in Package.resolved to pin Swift package versions in Xcode-managed projects if you add the file from within the generated project.xcworkspace file in your .xcodeproj bundle:
The current TelemetryDeck for web setup guide (version of 2023-12-01) is quite simple. Insert this into your HTML, and you’re set: From that point onward, you’ll be collecting signals per web site hit. Internally, the signal’s type is "type":"pageview". These signals will include all the usual suspects: browser, os and version, url (the page that was visited), and also referrer (where visitors may have come from, following a link).
TableFlip v1.5.1 just got approved to the Mac App Store (direct customers got the update a bit earlier, as usual). Again: kudos to Marin Todorov for the export improvements on HTML! From the release notes: Oh boy, just wait for v1.6.0 🥁 It’ll be really cool. Until then, get TableFlip today and enjoy some plain text table flipping.
This is a note from 2022 I found by accident today. Teaser: It will become relevant again, soon, so I want to share the rough idea with you today. JSON data containing nested object lists within object lists, namely, arrays of objects within other arrays, cannot be mapped directly to a 2D table representation.
I’m upgrading my 4TB drives in the NAS to 12TB drives. “Let’s be clever,” I thought (foreshadowing), “and do two things in parallel!” So installing the next drive into the disk array of my Unraid NAS, I let Unraid do these tasks: Does that speed things up, though? No, not at all, because Preclearing a disk takes 3x as long: Around 21 hours for each step that checks every nook and cranny of the HDD.
Earlier today, I was posting some ad-hoc thoughts about how I prefer SwiftUI layout over programmatic AppKit on Mastodon. I expected this to become a blog post later today. But instead, I find myself thinking along the lines of: “am I holding this wrong?”
Marin’s a charismatic presenter and excellent storyteller. (He also later admits it’s his 65th tech talk, wow!)
There are a couple of gems:
One is the use of the (ficticious) AppKit property leftShiftPressedInCombinationWithTouchBarWhereAvailableRepresentsMouseEvent = 6 to illustrate that over the past 35 years, AppKit has become quite weird, actually.
Another is Marin’s summary of the whole situation right afterward:
Time makes perfect;
but also adds a hundred properties to every class.
– Marin Todorov, 2023
So I’ll spoil one more detail: “A 100% SwiftUI App” is not actually a hard sell to do all of your apps with 100% SwiftUI. Quite the opposite.
TableFlip v1.5.0 just passed App Store Review. Direct customers got the update already. Thanks to Marin Todorov for helping on this version! The better performance with large tables, HTML export, and overall fixes are of his making ❤️
Nathan Manceaux-Panot shared his contribution to Sparkle the other day, available in version 2.5 of the de-facto standard updater library for Mac: attaching CSS to parts of the release notes that are actually new to the user. Say you ship updates in x.x.1 increments to beta testers, but x.1.x updates on your public release channel.
Maybe you don’t know, but I’m organizing a local Urban Sketchers group in Bielefeld for 6 years. We meet regularly and draw and paint together. And that’s how I met your mother,
– I’d say if you were my child. As a birthday present, I got a Portable Painter Micro palette from my wife (she’s the best). It’s a watercolor palette holding 6 half-pans, and she picked colors to match Teoh Yi Chie’s 2021 palette, who historically very vibrant and fun paintings!
I’m usually not doing birthday posts, but a lot has happened, and it feels like more change is about to come. Ok, that’s the biggest change, and I could stop here. But there were other things that do pale in comparison, but which were still important: Aggregated time tracking stats on my computers (numbers differ from screenshot because some items appear again further down, e.g. for different app bundle IDs):
Upgrading to Emacs 29.1 worked like a charm. There’ve been a couple of small neat additions next to all the big changes like native tree-sitter support – and there’s one in particular that you could say I almost hate. When I compose email and decide to discard everything, I’m politely being asked whether I want to kill (aka ‘close’) the buffer and discard all changes. This applies to all other buffers that haven’t been saved, too, but I mostly run into this with email.
The Swift standard library has a mutating func append(contentsOf:), but not an immutable variant. Usually, the Array and Collection types offer both. I wonder why that’s not the case here. To be fair, the concatenation operator + does the same trick.
Last year, I posted my presentation video and slides for the CocoaHeads Aachen talk “Making Your App Extensible with JavaScriptCore”. Today I read about Simon Willisons’s presentation annotation tool. It’s a simple HTML file where you can put your slides, have Tesseract generate alt-text for each, and annotate the whole thing with simple Markdown. The generated output is HTML. It is genius. I love it, and here’s the slides + transcript (which I happen to have from editing the video anyway) of the JSCore talk.
I hadn’t looked at SwiftData at all until now. The thumbnail read “Store Images in SwiftData”, and I was immediately worried: I recall it’s a bad idea to store megabyte upon megabyte of binary data inside the DB, assuming it’ll be using a BLOB column.
Turns out that SwiftData isn’t that simplistic and my assumption is wrong if configured properly!
SwiftData models can manage storage outside to the database. That’s what @Attribute(.externalStorage) is for: “Stores the property’s value as binary data adjacent to the model storage.”
I ran into this, too, recently and wondered how everyone’s dealing with this. Because this is so annoying, I expected more outcries on the interwebs every day.
Maybe nobody is writing tests?
Either way: These helpers look very nice, and I’ll try them for sure. Should be part of the XCTest libray in my opinion. I seriously wonder why there’s no async XCTest assertion functions for this already.
If you’re just running into this for main actor isolation: One workaround that got suggested to me is to annotate the XCTestCase subclass itself with @MainActor to circumvent having to await isolated calls everywhere. (That doesn’t help for non-main actor-isolated calls, obviously.)
The whole responder chain is traversed like the following, via the documentation for NSApplication.sendAction(_:to:from:): First, NSResponder.respondsToSelector(_:) is called to check if the current candidate is a match; if this returns false, NSResponder.supplementalTarget(forAction:sender:) is sent to get to another receiver to delegate the call to.
Remember when I wrote about MVVM and eventually in 2015 produced this: I learned that the “view model” in the architectural style of MVVM is a “model of the view” instead of a “model for the view”. Let me explain the difference and the benefits of being able to chose between both.
Say you have a view component. You can control which subcomponents it displays for maximum reuse. One day, you end up configuring the available effects, or actions, of the view component. Let’s say it’s something like this, a made-up example: The delete case with its associated value sticks out a bit.
Is the following a thing in the U.S. of A, or common anywhere else, and I just didn’t notice that? For about a year, some people reply to email questions by interspersing their replies with my questions. That’s good in general to provide context. But what I don’t understand is the practice of adding the > at the beginning of lines of their replies.
Ok ok, I know Super Saturday Sharefest is not a thing, but it’s too late for Follower Friday, alright? I want to give a big shout-out to Matt Massicotte of ChimeHQ for dropping another awesome Swift open source package that makes using XPC Swift-ier. I’m really grateful for all the amazing work Matt has been doing and for sharing it with the community.
In my opinion, the new section headers of NSMenu don’t have enough top margin. In the WWDC 2023 example, there are no “descenders” in the menu title typo of e.g. “Section 2”. (Descenders are e.g. the lower-case g or p going below the baseline.)
My recent posts were about SwiftUI quirks and annoyances, so I want to share a short success story for a change: You can @import Swift Packages in Objective-C code just fine. (At least if they are Objective-C compatible.) I updated my WordCounter app to rely less on Carthage and use Swift packages where possible instead.
With Xcode 14.3.1 on macOS 13 (Ventura), I found that you cannot put SwiftUI.Menus inside Lists without breaking the key event loop – iff you also set the menu button’s .buttonStyle(.plain)! Once that button style is used, menu item interactions will make the app
I wanted to know how a SwiftUITextField gets to know its onSubmit handler to wire my own NSViewRepresentable to it (would be the same for a UIViewRepresentable). There’s no key for that block in the EnvironmentValues structure that you get from the “context”, though.
while loops with extra conditions (case let matching),
if-case statements.
(Missing, for completion: catch ... where in try-catch blocks.)
I believe there’s tremendous value in summaries like these to learn the Swift programming language and its syntax: these short summaries show a slice of different aspects of the language in close proximity.
The Swift language book tells you all about the structural programming features one after another in the Control Flow chapter: if, for, while, etc.
It also has a section on where, but that’s limited to the switch conditional statement.
The section on for loops doesn’t mention where clauses at all! You need to go to the Language Reference part of the book, where the formal grammar is explained, to read that a where-clause? is allowed.
for-in-statement → forcase? pattern in expression where-clause? code-block
So a post like Natalia’s reminds us about the similarity of different aspects of the Swift programming language.
It’s zooming in on where-clauses, and so the reader gets to know a different “view” into the syntax as a whole that is different from the book’s presentation.
This should be very valuable to get from beginner-level understanding of “I can do things in Swift” to a deeper understanding of recognizing similarities across different aspects of the programming language.
These should, in my opinion, be included in the language’s handbook to help with “deep learning”. Until then, I’m glad we have posts like Natalia’s!
Here’s my personal comparison of Android ebook readers for my Boox eink tablet. I would love to add drawings as annotations. Ratta Supernote devices do this splendidly by storing the pencil input directly, without handwriting recognition. (Example here.) This is the gold standard. Everything else requires multiple apps (to draw a diagram, for example) and import/export (of notes or EPUB book locations), which is also acceptable, but not ideal.
When you use the built-in “NeoReader” on a Boox tablet, you get the best pencil input and quite good highlighting and annotation support. If you don’t have a Onyx Boox eink tablet with that app installed, don’t bother looking for it on the Android/Google Play Store – that app is not available anywhere else, it seems. And the app of the same name on the Play Store is a QR Code Reader.
This will open my website in Safari on macOS, no matter your default browser: x-safari-https://christiantietze.deTry it! Depending on your platform and browser, this may not be clickable or not do anything (I have no clue what Android browsers would do with this).
I have been complaining on social media about the Xcode Console sticking to the bottom, and how I’d prefer a horizontal split etc. And there have been good suggestions to e.g. open a new Console tab or window. (Thanks Dominik Hauser for the tip!) That didn’t stick because I needed to adjust the Xcode behaviors and sometimes that didn’t compose well with what I’ve been doing.
I noticed that on mobile phones, wide tables wouldn’t scroll horizontally – instead, they broke out of the content container and everything looked a bit wonky. My goal: wrap <table> in <figure> and add figure { overflow-x: scroll; } to make the table scrollable inside its container.
Scroll down a lot to “Is your website training AI?” (direct anchor link), and you can enter a domain (e.g. yours!) to see how much that page has contributed.
Rank
Domain
Tokens
Percent of all Tokens
11
washingtonpost.com
55M
0.04%
106,350
forum.zettelkasten.de
190k
0.0001%
328,137
christiantietze.de
71k
0.00005%
718,385
zettelkasten.de
32k
0.00002%
Can’t beat a community effort like a forum, no matter how much or how long I post :)
Got the link and the idea to check my sites from jwz.org.
Update 2023-04-20: I should’ve checked the Post’s claims, first; they say it’s Google’s dataset, but that seems to be wrong. Here’s a short summary of the C4 dataset I could find:
Hugging Face’s “Models trained or fine-tuned on c4” sidebar contains Google-owned repositories, but Common Crawl doesn’t appear to be affiliated with Google directly. Wikipedia indicates that the Common Crawl foundation is founded by Gil Elbaz whose company “Applied Semantics” was acquired by Google. But the Common Crawl foundation isn’t, as far as I can tell.
The dataset is likely used by AI, including Google’s, but that’s different.
I stumbled upon this page: http://ratfactor.com/cards/um Dave Gauer describes how he has a shell script, um, that he can use as a man replacement to help remember how to use a command. Dave’s implementation uses the cards} from his own Wiki, because the um pages there are “consolidated, I won’t forget about them, it’s easy to list, create, and update pages.” (To be honest, though, I can’t figure out where his um cards actually are, and what they look like.)
I’m a happy FastMail user. If you want to be a happy, too, use my referral code for 10% off of your first year (and I’ll get a discount, too!) → https://ref.fm/u21056816 I never used their Masked Email feature, though, because it’s so cumbersome to create these addresses from the web UI. I all but forgot about this feature until today, when I looked for something else in my settings.
The ‘wiki’ pages I added some time ago are the best places to summarize topics and embed a list of related posts. So I added a page about VIPER and briefly had a look at my old posts.
On a side note, it’s funny how this approach looked kind of popular for a while, but never really caught on. Another example that programming is a pop culture. VIPER never made the Top 10. While it’s still an approach that does what it set out to do, the shorter ‘VIP’ tried to supplant it later, but the much less opinionated [view] coordinators really took the stage. (Crazy that Soroush’s post is from January 2015, which is 8 years ago.)
I’ve never touched GitHub Copilot in all these years, but everyone seems to be very happy with it. People recommend Copilot for all kinds of refactorings and repetetive tasks. So I figured I might give it a try and see how it works. Just yesterday, I used the Copilot Xcode plugin to write a lot of boilerplate for me. I can confirm it does its job.
TableFlip v1.4.1 passed App Store review and is now released: In my original draft for this post I wrote this: Direct customers got the update on Monday already. This plan was somewhat sort of holding up, but it was actually last week that I intended to publish it. And direct customers need to download the latest version manually, because I broke the auto-updater in the previous version.
Users of The Archive and Dropbox have reported issues with deleting files in their Dropbox-managed folders in the past weeks: the app would beachball forever. Apparently, Dropbox’s recent migration from ~/Dropbox to ~/Library/CloudStorage affects this. I had the occasional Google Drive user in the past months report similar issues but couldn’t make much sense of it – until now.
This picture shows one of the weird annoyances with Xcode and Swift packages. One package resolution step swallowed 45MB of my data. You’ve likely heard it elsewhere: when iOS developers need to work with Swift packages and Xcode but have a shoddy internet connection, tough luck! Xcode will fail to build because it’s “Resolving Packages” step inevitably fails.
Markus Müller (@m_mlr) recently did a presentation at CocoaHeads Leipzig about Jetpack Compose. – Thanks for the inspiring presentation, Markus! I learned a lot. Update 2023-01-24: Check out the sample project on GitHub!
In my conceptual post about equality vs identity, I mentioned Helge Heß’ advice to use a Dictionary with an ID as key, and the identified object as value when you would (wrongly) reach for Set and Hashable.
Helge Heß recently posted on Mastodon that he “still find[s] it disturbing how many #SwiftLang devs implement Equatable as something that breaks the Equatable contract, just to please some API requiring it. Feels like they usually should implement Identifiable and build on top of that instead.”
Today I learned that you can tell Emacs to use fontsets (or just “fonts”) for specific character ranges. Thanks to Alan at idiocy.org for the explanation! His example is this: Now instead of Emoji, which work fine in Emacs for me out of the box, I want SF Symbols. Yes, again.
The odd title gives it away – I don’t have a good use-case for this :) Dr. Drang shared how he displayed one random line of “Oblique Strategies” in his email signatures many years ago. The “Oblique Strategies” can be found here: http://www.rtqe.net/ObliqueStrategies/Edition1-3.html
New year marks the day Protesilaos releases modus-themes v4 into the wild; and my package update from MELPA already ingested preliminary changes on Friday Dec 30th (much to my chagrin, because I initially wanted to do something else than fiddling with my Emacs setup) that were absolutely not backwards compatible.