Utilize the power of the menu bar to speed up development

Image for post
Image for post
Photo by Raychan on Unsplash.

While developing, I commonly find that my screen real estate is at a premium. Typically, I will have more than one window open on my iMac — and often in full screen. Menu bar applications are a great time-saver when it comes to productivity while developing. They can quickly pop out over your main application and provide quick access to simple tasks without disrupting your workflow.

Here’s a great source for discovering menu bar applications:

If you are interested in creating your own menu bar application in SwiftUI, I have written a tutorial on that topic.

Without further ado, let’s…

Use view modifiers to import or export data in your application

Image for post
Image for post
Photo by Viktor Talashuk on Unsplash.

At WWDC 2020, SwiftUI introduced functionality for importing and exporting data to and from your applications with new @Environment variables. While these new additions are a welcome improvement to SwiftUI, they are a bit clunky. With the release of iOS 14 beta 6, Apple has provided us with a new set of view modifiers that reduce import and export friction.

Let’s explore these new view modifiers by creating a simple project that can import and export data as plain text.

Getting Started

Start by creating a new Xcode project using the iOS App template. …

Create a SwiftUI document-based app using reference types instead of value types for your document

Image for post
Image for post
Photo by Zan on Unsplash

At WWDC 2020, Apple introduced the creation of document-based apps created entirely in SwiftUI using the new DocumentGroup element. Along with this new addition, Xcode 12 also provides a built-in template for generating a document-based app using SwiftUI using FileDocument. The new template works great out-of-the-box if you are using value types for your document, but what about using reference types?

Luckily, Apple thought of this and also provided us with a protocol for reference typed documents called ReferenceFileDocument but (as of the time of writing this article) have not yet explained its usage. …

Learn how to create a menu bar application using SwiftUI

Image for post
Image for post
Photo by Adam Wilson on Unsplash

Menu bar applications are among some of the more useful applications you can install for macOS. The ability of menu bar apps to hover above other open applications make them great for quick tasks or for quick access to data. There are even websites dedicated to cataloging menu bar apps. In this tutorial we will create the skeleton for a menu bar application in SwiftUI.

A small (and lightweight) networking library for Swift with Combine

Image for post
Image for post
Photo by Thomas Millot on Unsplash

At WWDC 2019, Apple announced a new framework called Combine as a new way of dealing with asynchronous events in Swift. As of macOS 10.15 and iOS 13, Combine is now deeply integrated in many areas of the Foundation framework including Timer, NSNotification, and URLSession.

The Combine framework adds two new methods to URLSession for using a Combine Publisher:

func dataTaskPublisher(for request: URLRequest) -> URLSession.DataTaskPublisherfunc dataTaskPublisher(for url: URL) -> URLSession.DataTaskPublisher

While using a Publisher with Combine andURLSessionreally improves consuming a URL endpoint’s response data, it does not remove the pain of initializing and building a URLRequest. …

Create a reusable generic SwiftUI view to wrap dynamic Core Data content

Image for post
Image for post
Photo by Clément H on Unsplash

With the release of iOS 13 Beta 5, Apple gave developers a way forward with using Core Data with SwiftUI but provide little in the way of usage details:

While this change was welcomed, it wasn’t clear (after playing around with these new APIs for a bit) how one was supposed to fetch anything other than a predetermined set of data in your SwiftUI view.

The problem in a nutshell:


Aaron Wright

Software developer, and Maker from Lincoln, NE https://acwrightdesign.com

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