Attributed Strings have always been hard to work with. The most basic implementation, in UIKit, would be something like this:
This is bad enough, but it’s even worse for SwiftUI. The current accepted answer on Stack Overflow uses
UIViewRepresentable and some other unnecessarily complex code. However, that was the only way — until WWDC21.
Markdown is everywhere: on GitHub, Stack Overflow, Discord’s message bubble… and now, the awesome formatting language comes to SwiftUI! Everything works, even links:
Most big apps have some sort of help center, also known as a “knowledge base.” You know, the “What can we help you with?” screens.
Search up “knowledge base software,” and you’ll find countless services that offer this functionality… but have you looked at their pricing?
If you’ve created a new SwiftUI app using Xcode 13, you’ll notice that
Info.plist is missing. It’s not a bug. According to the Xcode 13 release notes:
“Projects created from several templates no longer require configuration files such as entitlements and
Info.plistfiles. Configure common fields in the target’s Info tab, and build settings in the project editor.”
That’s nice, but there’s a problem. All you get is a GUI, so you can’t see the underlying XML source code. This can be limiting when you’re resolving merge conflicts or when you just want to paste in some template properties.
Markdown is probably the easiest way to edit and format rich text. It’s also extremely popular, and pretty much everyone knows how to use it.
So, want to implement Markdown in your app? It used to be… complicated. You’d need to use a third-party Markdown parser, then display the result in a web view. If you wanted to use it with SwiftUI, well, good luck working with
Good news, though: At WWDC21, Apple released SwiftUI 3 with Markdown support! It’s one of the features that have kind of flown under the radar, but it’s also one of the most…
The developer could not even bother taking their own screenshots, it just HAD to be something taken straight from my app. But I have to give credit where credit is …
This is insane. Is there any way I can also report the apps?
Ever since Apple released the iPhone X, using the safe area has been a must-do for developers. You don’t want your work hidden under the notch or clipped beneath the status bar or under the rounded corners, etc.
The launch of the iPhone X along with the safe area came back in 2017, so I think it’s safe to say every iOS developer knows how to use it — if not, here’s the documentation.
But sometimes you need to dive deeper. You might want the safe area present in some views but not in others — maybe a blur partially…
In 2016, Apple released an iPad version of Swift Playgrounds. Paired with an external keyboard, it’s almost as good as Xcode and a lot faster, but it’s slightly oversimplified. Sure, you can write code, but what about adding files or playing audio?
When I was coding my playground for this year’s Swift Student Challenge, I started out using my iPad. It was extremely fast. Pressing “Run My Code” would yield the result in less than a second! But I hit some snags — the most significant one being there was no way to play audio! …