Inspecting HTTP Traffic With Instruments
Oct 11, 2021, 6:39 AM
Xcode 13 added a useful network instrument to record and analyze URL sessions and HTTP traffic.
Recording A Network Trace
To record a network trace, launch the profiler from the Xcode product menu (⌘I) and select the Network...
Safari 15 Theme Color
Sep 27, 2021, 5:28 AM
Safari 15 adds a theme color for the tab bar. Safari can automatically pick a color based on the content or you can manually set the color with a meta tag.
<meta name="theme-color" content="#1a5d8d">
Safari 15 Tab Bar...
iPhone 13 Screen Sizes
Sep 20, 2021, 5:52 AM
The 2021 iPhone 13 release feels like an incremental update over the iPhone 12. Not much has changed but here’s a recap of what you need to know to update your apps for the new devices.
The New Models In A Nutshell
The four new...
iPad 2021 Screen Sizes
Sep 17, 2021, 7:18 AM
The 2021 iPhone release included two updated iPad models. Here’s a recap of what you need to know when updating your apps for the new devices.
The New Models In A Nutshell
The two new devices are updates to the low cost iPad and the...
Stack View Changes In iOS 15
Sep 13, 2021, 5:07 AM
Apple didn’t add any new features to stack views in iOS 15 but they have made a subtle change to the implementation that might catch you out when deploying back to earlier iOS versions.
Stack View Fill Distribution
One of the things...
Restricting Dynamic Type Sizes
Sep 6, 2021, 6:59 AM
In iOS 15 you can set limits on the minimum and maximum sizes of dynamic type. It works for both UIKit and SwiftUI.
view.minimumContentSizeCategory = .medium
view.maximumContentSizeCategory = .accessibilityExtraLarge
Button Configuration in iOS 15
Aug 30, 2021, 5:24 AM
Apple gave buttons a big upgrade in iOS 15. You now create and update button configurations much like the changes Apple introduced for collection and table view cells in iOS 14.
Four Basic Styles
Starting in Xcode 13, there are four basic...
Making SwiftUI Views Searchable
Aug 16, 2021, 8:39 AM
SwiftUI gains a search field in iOS 15. The searchable view modifier lets you make any content view searchable reducing the need to roll your own search bar.
Searching SwiftUI Views
If you’ve ever struggled with UIKit’s...
Configuring SwiftUI Fetch Requests
Aug 9, 2021, 5:55 AM
In iOS 15, it’s easier to dynamically configure a Core Data fetch request for use with SwiftUI.
Creating Fetch Requests
In iOS 15, Apple gave SwiftUI a more convenient version of the property wrapper for creating Core Data fetch...
Scrolling With ScrollViewReader
Aug 2, 2021, 7:30 AM
How do you programmatically scroll a SwiftUI list to a specific item?
Scrolling A List To An Item
Here’s my SwiftUI challenge. I have a collection of country items that I’m showing in a List. I have a widget that shows a random...
Xcode 13 Missing Info.plist
Jul 26, 2021, 6:29 AM
When you create a new SwiftUI project with Xcode 13 you may notice it doesn’t have an Info.plist file. What’s going on?
I wrote this post based on Xcode 13 beta 3. I’ll update it if I see changes in future beta...
Xcode Column Breakpoints
Jun 21, 2021, 5:52 AM
Xcode 13 adds column breakpoints which work like a more granular version of line breakpoints. Here’s how you use them.
Xcode supports many different types of breakpoint but it’s the line breakpoint that I...
WWDC 2021 Viewing Guide
Jun 14, 2021, 8:42 AM
Here’s my viewing guide for the WWDC 2021 sessions I found interesting this year.
Where Do I Start?
Watch the Platforms State of the Union (SOTU) for a summary of what’s new. It has a demo of Xcode Cloud, Holly Borla...
Xcode Keyboard Shortcuts
May 31, 2021, 6:05 AM
I have a hard time remembering Xcode keyboard shortcuts. Here’s my cheat sheet of the ones I find useful enough to learn.
This is not a comprehensive list of every Xcode shortcut. There’s a limit to how many I can remember....
Changing The Core Data Test Store Location
May 10, 2021, 5:36 AM
A quick tip to change the default directory for your Core Data database files when unit testing.
Where’s My Core Data Store?
If you’re using NSPersistentContainer to setup your Core Data stack it provides a default, platform...
XCTUnwrap Optionals In Your Tests
May 3, 2021, 5:21 AM
Writing unit tests that handle optional values can be a pain. Force unwrapping is concise but causes a crash when it goes wrong. Conditional unwrapping is tiresome and clumsy. Apple added XCTUnwrap in Xcode 11 to clean up the mess....
Debugging Core Data
Apr 26, 2021, 5:04 AM
Apple recommends adding some launch arguments and environment variables to your Xcode schemes to catch and debug Core Data problems. I’ve known about some of these for a long time others were new to me.
Xcode 12.5 Playground Access To App Types
Feb 8, 2021, 8:59 AM
Xcode 12.5 has enhanced playground support. When you add a new playground to a project it defaults to having access to the types in your App target. This means you are not forced to import frameworks or Swift packages to share code between...
SwiftUI Container Relative Shape
Feb 1, 2021, 9:58 AM
SwiftUI has lots of ways to create rounded rectangles but what if you want to match the corner radius of a widget? Apple added ContainerRelativeShape to iOS 14 for that purpose.
The Apple Human Interface Guidelines for widgets suggests you...
Widget Background and Accent Color
Jan 25, 2021, 6:16 AM
When you create a new Widget you may have noticed that it gets its own asset catalog. As well as the usual AccentColor this also contains a WidgetBackground color. What are these for and how are you supposed to use them?
You might hope...
SwiftUI Custom View Modifiers
Jan 18, 2021, 6:14 AM
Create your own custom SwiftUI view modifier when you want to reuse a set of modifiers on multiple views. Removing duplication also cleans up and improves the readability of your SwiftUI views.
Here’s my starting point. A SwiftUI...
Using Swift Result and flatMap
Jan 4, 2021, 10:08 AM
The Swift Result type is handy way to capture the results of a throwing expression that you need to execute on a background thread. Use flatMap to chain several results together.
The Swift Result Type
Apple added the Result type to the...
Swift If Case Let
Dec 21, 2020, 8:31 AM
The Swift If-Case-Let syntax is a convenient shortcut to avoid a full switch statement when you only want to match a single case. The syntax always seems backwards to me so here’s a reminder of how to use it.
Case Let - A...
Creating dynamic dark mode images at runtime
Dec 14, 2020, 8:44 AM
If you’re creating your images from the asset catalog you support dark mode by adding light and dark variations of the image. How about when you’re creating the images at runtime? How about when you’re using SwiftUI?
Showing Maps in Widgets
Dec 7, 2020, 7:56 AM
If you want to show a map view in a widget your first thought might be to use a MapKit Map view. Unfortunately WidgetKit doesn’t allow it. What you can do is create a snapshot of the map and show that.
I’m not going to cover...
Adding Views and Modifiers to the Xcode Library
Nov 30, 2020, 7:57 AM
Xcode 12 allows you to add your own custom SwiftUI views and modifiers to the Xcode Library. Here’s my quick summary of how it works.
The Xcode Library provides you a way to browse the available SwiftUI views and...
WidgetKit for iOS - Getting Started
Nov 23, 2020, 7:49 AM
Widgets seem to be the surprise hit of iOS 14. Here’s my guide to get you started building widgets with WidgetKit.
Widgets in iOS 14
Apple introduced widgets in iOS 14 at WWDC 2020. They allow you to show a small piece of your...
Slow Swift Compiler Performance
Nov 9, 2020, 11:52 AM
I went down a rabbit hole looking at Swift compiler performance this week. Since most of the diagnostic flags are unsupported they are not well documented. For future reference here’s my summary of what’s available.
iPhone 12 Screen Sizes
Oct 19, 2020, 5:39 AM
The 2020 iPhone release brings us four new models with three new device sizes including a 5.4" mini. Here’s a recap of what you need to know to update your Apps for the new devices.
The New Models In A Nutshell
The four new...
Using Swift Packages in Playgrounds
Oct 12, 2020, 11:06 AM
Xcode 12 playgrounds can now import and use Swift packages. It’s not the solution I was hoping for but it’s a step in the right direction.
I’ve written in the past about my attempts to add playgrounds to Xcode projects....
Launching iOS Apps with a Custom URL Scheme
Sep 21, 2020, 8:30 AM
I’ve been experimenting with widgets recently which led me to wanting to launch apps with custom URLs. Trying and retrying different URLs during development is tiresome and I couldn’t remember the different ways to do it....
SwiftUI Preview Data
Aug 31, 2020, 4:10 AM
One of the great features of SwiftUI is the Xcode support for previewing views without launching the simulator. This speeds up development but where do you keep your preview data? If you’re not careful your view code can become...