Test Network Quality from Terminal on macOS
:til: you can test your network quality directly from the terminal on macOS! :rocket:
Quick learnings, discoveries, and “aha!” moments. Short, focused posts with code snippets, tips, and tricks I pick up along the way.
:til: you can test your network quality directly from the terminal on macOS! :rocket:
that we now use safeAreaBar from iOS 26+ to show the specified content as a custom bar beside the modified view
With Swift 5.9 we can now use if and switch statements on the right-hand side of the = sign, like this:
In Swift 6.2, String interpolation has a new default value parameter that accepts a string regardless of the type of the optional value:
The new Declared Age Range API in enables us to request a user’s age bracket (e.g., under 13, 13–17, 18+) instead of exact birthdate.
On iOS 26, you can now directly apply the matchedTransitionSource modifier to any ToolBarItems
that we can use LogForEachSlowPath in the launch argument so SwiftUI can log warnings in the console for us.
GitHub issues/PRs have slash commands (public preview). Type / in any comment to get helpers like: /table (build a table) /details (collapsible block) /code (code block) /saved-replies (supports %cursor%) /template (insert issue/PR templates)
In iOS 26.0+, we have a new .confirm button role.
to log memory usage without Xcode
In iOS 16+, use toolbarTitleMenu() to present a menu when users tap the navigation title.
Xcode 26 now shows the matching #if condition next to #endif. No more guessing or writing manual comments
you can reset iOS Simulator permissions for your app without erasing the whole simulator
that SwiftUI has five built-in hierarchical text styles you can use to visually prioritize content — just like system apps do!
If you need to shrink a video before attaching it to a GitHub PR, just open it in QuickTime Player → File → Export As → pick a lower resolution. Super quick!
Xcode now shows a loading indicator when you are executing something
iOS 26 now allows us to configure the navigation subtitle which was already there for macOS
if you add UIDesignRequiresCompatibility to your Info.plist and set it to YES, your app will run using the old OS design instead of the new Liquid Glass design. Apple will remove this starting Xcode 27 so we have a bit of time to migrate.
The SwiftUI navigationLinkIndicatorVisibility(_:) has been backported to iOS 17.0+
You can now customize the spacing between a label’s icon and title with the new .labelIconToTitleSpacing() modifier in iOS 26
iOS 26 has an inbuilt WebView
You can reset all privacy permissions (camera, location, contacts, etc.) on the iOS Simulator using this one-liner:
UserDefaults has a size limit, and Apple provides a notification for when you go over it: UserDefaults.sizeLimitExceededNotification
Favor keypath-based bindings (like $value) over manually constructed bindings using Binding(get:set:) in production code.
In Swift 6.0, protocol extensions get enhanced support for generic constraints
SwiftUI has a modifier that lets you hide sensitive information by adding a single line of code .privacySensitive() and it will automatically hide the view it’s attached to as soon as the app goes into the background
In iOS 17+, we can make a button trigger its action repeatedly if the user holds it. This makes it very easy for our customers to add the same item multiple times
The @frozen attribute in Swift indicates that a struct or enum’s layout is fixed and won’t change in future versions of the library or module where it is defined. This allows the compiler to make optimizations based on the assumption that the type won’t gain new stored properties (for structs) or...
We can easily get the parallax effect from iOS 17 with just a few lines of code
When comparing strings that can vary by language or locale (e.g., backend-provided titles and locally stored titles in different languages), you can use String.compare(_:options:range:locale:) to handle case and diacritic insensitivity while respecting the system’s locale settings. More hereUse ....
Use the mask() modifier to apply a custom shape or view as a clipping mask.
bout the scrollIndicatorsFlash modifier in SwiftUI (iOS 17+), which flashes the scroll indicators of scrollable views whenever a bound value changes. This is great for drawing attention to scrollable content, ensuring users don’t miss important information. Learn more in the official Apple docume...
When migrating to @Observable, lazy variables are not supported. Replace them with computed properties or initialize them directly to ensure compatibility or use @ObservationIgnored
if someone is looking to test closures using Swift Testing
We can start a scroll view at the bottom with the .defaultScrollAnchor(.bottom) modifier.
When comparing two strings, it is always a good idea to search with String’s built-in method rather than directly comparing .lowercased() becauseThe method .lowercased() creates a new copy of each String every time it’s called, which might have a negative impact on performances.To provide a great...
Swift provides a solution with a built-in function called zip. This function allows for combining two sequences into a sequence of tuples, enhancing code cleanliness and readability.
TIL: iOS 16 has an API that returns the standard gradient for the color self