Home Tech SwiftUI for Mac 2024

SwiftUI for Mac 2024

24
0
SwiftUI for Mac 2024

Over the years, I really hang written articles and sample apps to level the original aspects of every twelve months’s SwiftUI updates with particular emphasis on macOS app pattern. Final twelve months, the foremost change to SwiftUI was once the original knowledge waft arrangement the use of the Observation framework. I covered that in my article SwiftUI Information Float 2023 nonetheless I didn’t feel there had been ample UI adjustments to warrant an change to my long-established sample app.

This twelve months, the HTTP Cats app is back! And I’ll quilt original aspects from each WWDC 2023 and WWDC 2024.

It’s in the in the period in-between August 2024 and I’m working macOS Sequoia 15.1 Beta (24B5024e) with Xcode 16.1 beta (16B5001e).

In finding the mission from GitHub and, for those that’re working the correct versions of macOS and Xcode, you might well also escape the app and apply along. If now now not, you might well also restful perceive at the code, on the other hand it gained’t rep.

HTTP Cats

Warning: there’s a pc virus lawful now that crashes the app in macOS 15.1. Within the occasion you scroll down the checklist in the sidebar after which decide a location that is more than 8 or 9 rows under the outdated replacement, the app crashes with this error: Row index -1 out of row range (numberOfRows: 60). I’ve tested this with Xcode 16.0 beta 6 and Xcode 16.1 and besides they each act the same. But on a pc working macOS 15.0 beta 7 and Xcode 16.0 beta 6, it indubitably works completely. So this is a pc virus in macOS 15.1.

Right here are the areas that I’m going to focus on about:

Xcode

Whenever you form a brand original mission in Xcode 16.1, the 2d item in the mission navigator is now a folder in location of a workforce. This sounds trivial, since it indubitably is a folder in Finder nonetheless I derive it indubitably traumatic on sage of it doesn’t enable me to put up my completely different files and folders as I prefer them. To fix this, lawful-click on the folder and decide Convert to Neighborhood. The icon switches from blue to gray and besides you might well also once any other time drag files and folders to re-tell them.

The aid to the folder possibility is that your mission is read straight from the file arrangement, so you might well also use Finder to transfer files around and Xcode will replicate the adjustments. To import a file into the mission, you might well also drag it into the mission’s Finder window and Xcode will peer it. Similarly, to delete a file, you might well also use Finder straight. With the workforce possibility, you hang to import files into the Xcode Challenge navigator, and for those that attain, source control marks the .xcodeproj file as modified, making source control messier. Utilizing the folder possibility, very top the original file itself gets marked as a alternate. So use which possibility works for you, nonetheless I valuable desire the readability of being in a space to prepare my files in the Challenge navigator.

The subsequent dispute to perceive at in Xcode is Predictive Code Completion. While the Xcode betas escape on macOS Sonoma, predictive code completion requires Sequoia and I deem it additionally requires at the least 16GB of memory. We don’t yet hang the promised Swift Lend a hand that would also enable for a more detailed manner of asking Xcode to jot down code, nonetheless the code completion is supposed to be valuable greater.

I’ve frail GitHub Copilot for writing JavaScript for a couple of years now and total, it indubitably works neatly. I use it as a form of broad autocomplete and focused search moderately than asking it to jot down big chunks of code for me, and that’s what I’m hoping to derive for Swift now. Xcode has a technique to journey to win up yet. Surprisingly, it suffers from idea to be one of the critical same complications as Copilot – it appears to be like to hang been educated on extinct code!

I do know some of us are very harmful about the use of any form of AI to jot down system of your code, nonetheless I peer it as factual any other utility to support us be more atmosphere friendly. For example, I bet you’ve written code to download and job JSON many, persistently. Why now now not let Xcode write that for you? You restful hang to attain the pondering. What’s the URL? Which properties attain I prefer? How am I going to make use of the information? But you don’t hang to jot down the boilerplate. It’s no completely different to the use of a library or a pre-constructed feature.

I effect predictive code completion to the take a look at by making a brand original Swift file called Networker.swift.

 » …
Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here