SwiftUI EnvironmentValues
Issue #922
EnvironmentValues Views in SwiftUI can react to configuration information that they read from the environment using an Environment property wrapper
Updated for iOS 17
Discover all the tech
Issue #922
EnvironmentValues Views in SwiftUI can react to configuration information that they read from the environment using an Environment property wrapper
Updated for iOS 17
Issue #921
Use HStack with TextField and a little extension
extension Binding where Value == Int {
var toString: Binding<String> {
Binding<String>(
get: {
"\(wrappedValue)"
}, …Issue #920
For iOS 16 and macOS 13.0
TextEditor(text: $text)
.scrollContentBackground(.hidden)
For below, use [SwiftUI-Introspect](https://github.com/siteline/SwiftUI-Introspect)
TextEditor(text: $text)
.instrospectTextView {
$0. …Issue #919
WWDC23 introduces lots of new additions to SwiftUI, notably Metal shader support with these modifiers
Issue #918
Interesting SwiftUI Q&A during WWDC23
Q: With the new SwiftUI @Observable macro, are there any cases where ObservableObject would still be a better alternative?
A: Use ObservableObject when you need to …
Issue #917
Interesting SwiftUI Q&A during WWDC21
Q: Let’s say I have a purely SwiftUI flow. I have a ListView with a @StateObject var listFetcher, that makes requests for a list of items. Tapping on an item in the …
Issue #916
WWDC23 brings new additions to SwiftUI
The scroll transition modifier is very similar to the visual effect modifier Curt used earlier for the welcome screen. It lets you apply effects to items in your scroll view.
I’m …
Issue #915
Here are my favorite iOS articles
Issue #914
Use react-markdown to parse markdown content, react-syntax-highlighter to highlight code, and rehype-raw to parse raw html
import ReactMarkdown from "react-markdown"
import { Prism as SyntaxHighlighter } from …Issue #913
Use QuickLookThumbnailing framework
import AppKit
import QuickLookThumbnailing
actor QuicklookService {
static let shared = QuicklookService()
private let generator = QLThumbnailGenerator.shared
func image( …Issue #912
Perform check before and after suspension point
actor Worker {
var isDoing = false
var toBeDone = Set<String>()
func work(string: String) async {
if isDoing {
toBeDone.insert(string) …Issue #911
Make an parallelTask function that wraps TaskGroup
public func parallelTask(@ParallelTaskBuilder builder: () -> [ParallelTaskBuilder.Work]) async {
await withTaskGroup(of: Void.self) { group in
for work in builder() { …Issue #910
let string = "Hello world"
string[string.startIndex...] // Hello world
string[..<string.endIndex] // Hello world
let string = "Hello world"
let range = string.startIndex ..< …Issue #908
When we add another UIWindow, then its rootViewController will decide the style of the status bar, not the rootViewController of the keyWindow anymore
The usual way to fix this is to defer the decision to the correct …
Issue #905
Protect mutable state with Swift actors
Actor reentrancy
Imagine we have two different concurrent tasks trying to fetch the same image at the same time. The first sees that there is no cache entry, proceeds to start downloading the …
Issue #904
Consider this code where we have an ObservableObject with fetch1 and async fetch2, and a fetch inside ContentView
Here the observation in Xcode 14
Issue #903
let image = NSImage(contentsOf: url)
let imageView = NSImageView(image: image)
image.animates = true
I’m a thinker and storyteller with a passion for exploring the intersection of creativity and technology
🧑💻 I love crafting high quality and useful apps
🔥 I love open source. My GitHub open source has 2.3k followers with packages that are integrated by 45k+ apps and over 3.4m+ downloads on CocoaPods.
✍️ I write here on my blog and on Medium, which has over 2.7k+ followers with tons of articles and 90k+ monthly views.
🖥 Follow me for sharings about Swift, SwiftUI, iOS and macOS development.