With SwiftUI 2, it’s incredibly easy to add keyboard shortcuts to actions and to add buttons to your app’s menu bar.

Keyboard Shortcut

You can add keyboard shortcuts to actions simply by adding .keyboardShortcut(_:) to the button:

You can set nearly every character as KeyEquivalent . But note, that you can’t toggle the button by simply pressing “B”. When using letters like “V”, you need to press “⌘⇧V”, when using numbers like “6”, you need to press “⌘6”. You can also specify your own modifier keys, by passing them to the modifier parameter.

You can define a single one, or…

When you have an iOS app, especially when it displays information, you maybe use InsetGroupedListStyle on your List . This looks any like this:

iPad, Info from mactracker.ca

But there is a problem, when you want to display this view on macOS. InsetGroupedListStyle is unavailable for native apps (It’s available for Mac Catalyst though). And when you use alternative list styles for the list, it looks like this:

Since iOS 13 Apple has a Google Street View like feature to look around cities, called Look Around. With macOS 11 Big Sur, you can now useLook Around on Apple Maps for Macs. In this article, I will compare both services.

Where to use

Look Around can be used in the Apple Maps app for iOS and macOS. Street View can be used in the Google Maps app, the Google Street View app, the Google Earth app, Google Maps in the browser, etc. You can see, Street View is much more accessible that Look Around, especially when you put other operating systems into…

There are two things to consider when building an app, that should look good on every device. Different screen sizes and text scaling. And that’s what this short article is about, so let’s dive right into it.

Shapes and views

When you add a frame to shapes or views, with absolute values, you will probably notice, that it doesn’t look good on every device. And if not, run on multiple simulators. Or even easier, change the device and see the changes in the Live Preview.

iPhone 11

Image source iphonehacks.com

With iOS 13 Apple changed from a big, disruptive UI for silent mode and volume to smaller and more focused UIs, that don’t take up the whole screen. There are buttons in your app, where a feedback is more intuitive for the user, but not so important to disrupt the whole screen with an ActionSheet . Examples are “Added to favorites” or “Saved image”. For that, a simple info sheet at the top is great.

Building your quick info sheet

The HUD will be displayed in a layer above the main app interface. To do so, wrap the view elements in your ContentView in a…

ContextMenu and Menu can be both used to display quick actions. Context menus can be used, to add actions to an object, for example an image, and menus are more for view wide actions, like changing list filters. Both look nearly the same, but context menus enlarge the object and blur the background. while menus just cast a shadow. Context menus can be toggled by a long press, menus by a simple tap. In this article, I will explain when to use them, how to use them and what you can do with them.


Context menus add quick actions to…

Group boxes can be used, to group content together. With SwiftUI 2 they are also available on iOS. A default GroupBox has two possible states. Without a label, the background size depends on the content. With a label, the background pushes to the side.

The syntaxt of a GroupBox is pretty simple. Instead of the text you can use every view.

By default, the content is put in a VStack .

In my opinion, group boxes are great to display information, stats, achievements, history and more. A great example is Apple’s Health app. …


Pickers can be used to let the user select a value from a fixed set of options.

There are multiple types of pickers in SwiftUI, Picker , DatePicker , ColorPicker and in some way also TabView .

Ways to create your Picker

The most prominent way of creating a picker is with an Integer value. But you can also use every other value type as selection. For example boolean values:

Of course, boolean pickers like that are kind of sensless and should be better replaced with a Toggle , but if you only have two values, that don’t represent true or false you…

When you have a media app, you probably want a “Now playing bar”, just like Spotify, Apple Music, YouTube or Podcasts. But you don’t need to be a media app, to have a info bar at the bottom. In this article I will show how to add a “Now playing bar” and some examples, on how to implement an info bar in your SwiftUI app.

Preparing for the “Now Playing Bar”

When you have a media app, it probably looks anything like this:

Image source: Interactive Powers’ elaboration

With SwiftUI 2 you can open URLs with the new Link structure. You can also open URLs in-app with a SFSafariViewController . But maybe you want to give the user the choice, if he wants the link to be opened in-app, in Safari or even in other browsers like Google Chrome, Firefox or Opera.

Browser selection

The selection will be stored in UserDefaults . If you only want to give the user two options, you can use a Bool value, if you want multiple use Int .

For every other browser put this in the Picker :

Just replace the…

Luca J.

Hi. I’m a German student loving everything Apple. I recently started iOS development, focused on SwiftUI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store