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…
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.
Start by creating a new Xcode project using the iOS App template. …
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. …
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.
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
The Combine framework adds two new methods to
URLSession for using a Combine
func dataTaskPublisher(for request: URLRequest) -> URLSession.DataTaskPublisherfunc dataTaskPublisher(for url: URL) -> URLSession.DataTaskPublisher
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:
NSManagedObjectnow conforms to
ObservableObject. The new
@FetchRequestproperty wrapper can drive views from the results of a fetch request, and
managedObjectContextis now included in the environment. (50280673)
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: