Quantcast
Channel: Nil Coalescing
Browsing latest articles
Browse All 163 View Live

Get URLs for system folders in iOS 16

Get URLs for system folders in iOS 16Working with files and directories got a lot easier in iOS 16. Previously, to obtain the path to a file in the application folder, we had to use FileManager APIs,...

View Article



Delay an async Task in Swift using the new clock APIs

Delay an async Task in Swift using the new clock APIsIn Swift 5.7 we have new APIs for interacting with time, that consist of three main components: clock, instant and duration. We can use these new...

View Article

Image may be NSFW.
Clik here to view.

Programmatically open a new window in SwiftUI on macOS

Programmatically open a new window in SwiftUI on macOSIn macOS 13 we finally have a way to programmatically present a window in SwiftUI. We can call the new openWindow action from the environment and...

View Article

Sort elements based on a property value using KeyPathComparator

Sort elements based on a property value using KeyPathComparatorIf we have an array of elements in Swift and we need to sort it based on a specific property, we can't use the simple sorted() method.For...

View Article

Image may be NSFW.
Clik here to view.

Customizable toolbar on iPad in SwiftUI

Customizable toolbar on iPad in SwiftUIUser customization for toolbars has existed on macOS for a while, but starting from iPadOS 16, this feature is also available on iPad. This was part of many other...

View Article


Image may be NSFW.
Clik here to view.

Using Measurements from Foundation for values in Swift Charts

Using Measurements from Foundation for values in Swift ChartsIn this post we are going to build a bar chart, comparing durations of nature walks in the Christchurch area. We will be using the new Swift...

View Article

Adjust the direction of focus-based navigation in SwiftUI

Adjust the direction of focus-based navigation in SwiftUIWhen the user navigates through focusable views in our app with the tab key, the focus will move in the reading order: first from the leading...

View Article

Display high precision time with Duration and TimeFormatStyle

Display high precision time with Duration and TimeFormatStyleIn iOS 16 and macOS 13 the Foundation framework has a new way of representing and formatting an elapsed time value with high precision in an...

View Article


Change TextEditor background in iOS 16

Change TextEditor background in iOS 16Starting from iOS 16 we can set a custom background for TextEditor in SwiftUI using a combination of scrollContentBackground() and background() view modifiers. We...

View Article


Image may be NSFW.
Clik here to view.

Large content viewer in SwiftUI

Large content viewer in SwiftUIiPhone users can adjust preferred text sizes in their device settings. There are 7 text sizes available by default from extra small to extra-extra-extra large. Users can...

View Article

Image may be NSFW.
Clik here to view.

Editable navigation titles in SwiftUI on iOS 16

Editable navigation titles in SwiftUI on iOS 16Starting from iOS and iPadOS 16 we have a new version of the navigationTitle(_:) modifier that accepts a binding to a string. We can use this modifier to...

View Article

Image may be NSFW.
Clik here to view.

Dynamic dates with monospaced digits in SwiftUI

Dynamic dates with monospaced digits in SwiftUIWhen using the Text view in SwiftUI we can show dates and times that automatically update as time passes. To achieve it we can interpolate a date with a...

View Article

--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article


--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article

--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article


--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article

--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article


--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article

--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article

--- Article Not Found! ---

*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***

View Article

Image may be NSFW.
Clik here to view.

Image accessibility labels from Localizable.strings files

Image accessibility labels from Localizable.strings filesI recently discovered that if we add an image name to the Localizable.strings file in a SwiftUI project, SwiftUI will automatically use the...

View Article


Image may be NSFW.
Clik here to view.

Text modifiers in SwiftUI

Text modifiers in SwiftUIApart from regular view modifiers in SwiftUI, there are also text modifiers. They apply specific styles to a Text view and return another Text rather than some View. We can see...

View Article


Image may be NSFW.
Clik here to view.

Customize ShareLink appearance with view modifiers

Customize ShareLink appearance with view modifiersWhile we can provide a fully custom view as a label of the ShareLink in SwiftUI, we can also customize the default appearance with view modifiers...

View Article

Image may be NSFW.
Clik here to view.

Tracking hover location in SwiftUI

Tracking hover location in SwiftUIFor a while we only had onHover(perform:) modifier in SwiftUI that is called when the user moves the pointer over or away from the view’s frame. There used to be no...

View Article

Image may be NSFW.
Clik here to view.

Reading keyboard modifiers on iPad in SwiftUI

Reading keyboard modifiers on iPad in SwiftUIWith the advent of desktop class iPadOS applications there are many macOS UX idioms I would like to bring to our iPad apps. One such UX pattern is hybrid...

View Article


Image may be NSFW.
Clik here to view.

Show chart annotations on hover in Swift Charts

Show chart annotations on hover in Swift ChartsIn this post we are going to see how to create an interactive bar chart that shows chart annotations when the user is hovering over bar marks. The bar...

View Article

Image may be NSFW.
Clik here to view.

Using foregroundColor(), foregroundStyle() or tint() to set text color in...

Using foregroundColor(), foregroundStyle() or tint() to set text color in SwiftUISwiftUI has a few different modifiers that can change the color of text, such as foregroundColor(_:),...

View Article

Image may be NSFW.
Clik here to view.

Using Layout protocol to align explicitly positioned views in SwiftUI

Using Layout protocol to align explicitly positioned views in SwiftUIWe've just released a big update to our app Exsto, and one of the main additions was an interactive tutorial for new users. The...

View Article

Image may be NSFW.
Clik here to view.

Testing remote push notifications on iOS simulator in Xcode 14

Testing remote push notifications on iOS simulator in Xcode 14I recently discovered that starting from Xcode 14 we can test remote push notifications on an iOS simulator. Before this, simulators were...

View Article



Image may be NSFW.
Clik here to view.

Using compositing group for unifying shapes within buttons in SwiftUI

Using compositing group for unifying shapes within buttons in SwiftUIWe are adding some in-app purchase buttons in our next update in Exsto and we noticed a visual glitch in button pressed state. Since...

View Article

Image may be NSFW.
Clik here to view.

Swift enum pattern matching with extra conditions

Swift enum pattern matching with extra conditionsIn this post we are going to explore how we can provide more precise conditions for pattern matching when working with enums in Swift. The most common...

View Article

Image may be NSFW.
Clik here to view.

Inspectors in SwiftUI

Inspectors in SwiftUIAt WWDC23 Apple just released a load of new SwiftUI improvements. Among them there is a new SwiftUI inspector(isPresented:content:) modifier.On macOS and iPadOS this modifier adds...

View Article

Image may be NSFW.
Clik here to view.

Access colors and images from asset catalog via static properties in Xcode 15

Access colors and images from asset catalog via static properties in Xcode 15Xcode 15 beta comes with a great new way to access colors and images stored in asset catalog. It automatically generates...

View Article


Image may be NSFW.
Clik here to view.

if/else statements as expressions in Swift 5.9

if/else statements as expressions in Swift 5.9Swift 5.9 that comes with Xcode 15 introduces a nice feature, it allows us to use if/else statements as expressions. We can return values from functions,...

View Article

Image may be NSFW.
Clik here to view.

ControlGroup in context menus in SwiftUI

ControlGroup in context menus in SwiftUIStarting from iOS 17 and iPadOS 17 we can now use a ControlGroup inside a contextMenu(), enabling more compact access to common actions. ContentView()...

View Article

Image may be NSFW.
Clik here to view.

Keyboard driven navigation with focusable() on iPad in SwiftUI

Keyboard driven navigation with focusable() on iPad in SwiftUIThe recent updates to iOS 17 and iPadOS 17 have brought about exciting changes, one of which is the introduction of the focusable()...

View Article


Image may be NSFW.
Clik here to view.

See all parameter permutations in code completion in Xcode 15

See all parameter permutations in code completion in Xcode 15Xcode 15 beta comes with some great improvements to code completion. One of my favorite is the ability to view all possible permutations of...

View Article


Image may be NSFW.
Clik here to view.

Interpolate text with custom foreground style in SwiftUI

Interpolate text with custom foreground style in SwiftUISwiftUI lets us style portions of text by interpolating Text inside another Text and applying available text modifiers, such as foregroundColor()...

View Article

Image may be NSFW.
Clik here to view.

Notification action buttons with images in iOS

Notification action buttons with images in iOSAction buttons are a vital part of the iOS notification system, allowing users to interact with notifications directly from the home screen. According to...

View Article

Image may be NSFW.
Clik here to view.

iOS app setup for remote push notifications

iOS app setup for remote push notificationsRemote push notifications are messages that app developers can send to users directly on their devices from a remote server. These notifications can appear...

View Article

Image may be NSFW.
Clik here to view.

Filtering logs in Xcode 15

Filtering logs in Xcode 15We have some great new features in the debug console in Xcode 15. I'm particularly excited about improved filtering functionality that makes it much easier to view console...

View Article


Image may be NSFW.
Clik here to view.

Hierarchical background styles in SwiftUI

Hierarchical background styles in SwiftUIBefore iOS 17 to get hierarchical system background colors in SwiftUI we usually had to convert them from UIColor. For example, to get the secondary system...

View Article

Image may be NSFW.
Clik here to view.

Using Observation framework outside of SwiftUI

Using Observation framework outside of SwiftUIThis year at WWDC 2023 Apple introduced the new Observation framework which provides an implementation of the observer design pattern in Swift. Classes...

View Article


Image may be NSFW.
Clik here to view.

Create an AsyncStream from withObservationTracking() function

Create an AsyncStream from withObservationTracking() functionAfter Natalia wrote her previous post on how to implement the observer pattern in Swift in iOS 17 Using Observation framework outside of...

View Article

Image may be NSFW.
Clik here to view.

Trigger property observers from initializers in Swift

Trigger property observers from initializers in SwiftIn Swift, property observers such as willSet and didSet are not called when a property is set in an initializer. This is by design, as the...

View Article


Image may be NSFW.
Clik here to view.

Pattern matching for custom types in Swift

Pattern matching for custom types in SwiftPattern matching in Swift is a technique that allows us to check and de-structure data in a concise way. It's most often seen in switch statements, where it...

View Article

Image may be NSFW.
Clik here to view.

Case insensitive string comparison in Swift

Case insensitive string comparison in SwiftString comparison is a fundamental aspect of many programming tasks, from sorting and searching to data validation. The simplest method to compare two strings...

View Article

Image may be NSFW.
Clik here to view.

Use cases for self, Self and Self.self in Swift

Use cases for self, Self and Self.self in SwiftThe Swift language constructs self, Self, and Self.self can sometimes be a source of confusion, even for experienced developers. It's not uncommon to...

View Article

Image may be NSFW.
Clik here to view.

User-friendly descriptions and recovery suggestions for custom errors in Swift

User-friendly descriptions and recovery suggestions for custom errors in SwiftCreating a seamless user experience in Swift involves not just managing errors but also communicating them effectively. By...

View Article


Image may be NSFW.
Clik here to view.

Sending trial notifications with provisional authorization on iOS

Sending trial notifications with provisional authorization on iOSIn the world of iOS app development, engaging users effectively while respecting their preferences is crucial. Notifications can be a...

View Article

Browsing latest articles
Browse All 163 View Live




Latest Images