WWDC 22’s Twitterati Roundup: Highlights From SwiftUI 4 for iOS 16 | by Anupam Chugh | Jul, 2022

Echoing the brand new options via tweets

Photograph by Rubaitul Azad on Unsplash

Now that the euphoria of WWDC 22 has subsided, right here’s a have a look at a few of the greatest tweets that can assist you get a pulse of most developer bulletins from the occasion.

Beginning iOS 16, we now have a Charts framework to simply create a Bar, Line, Space, Level, or Rule chart with customizable axis, and legends.

See find out how to annotate a PointMark SwiftUI chart with nearly any view — within the beneath case, utilizing SF Symbols:

For Linear gradients with the identical colour, you needn’t use the LinearGradient constructor anymore. Paul exhibits find out how to invoke gradient on a colour to straight deliver that impact to your views:

My favourite new SwiftUI function is the power to export views as pictures through the use of the ImageRenderer.

However are you aware find out how to match the view’s decision? Fortunately, there’s a scale property you could name on the ImageRenderer occasion as demonstrated within the beneath tweet by Daniel:

We are able to straight set the editable listing choices — like swipe to delete or reorder inside the brand new init operate’s edits argument:

A context menu with a preview that shows on high of the menu? You’ve received it:

A built-in SF Symbols search inside Xcode 14 is a welcome addition. However the brand new variable colour function upons so many alternatives to show state-driven symbols…like a progress indicator as proven within the beneath tweet:

Out-of-the-box help for Grids would absolutely assist construct extra complicated layouts in SwiftUI. Just like the beneath tweet demonstrates (with gist pattern) exhibits find out how to use Grids with SF Symbols and Timeline view.

To construct customized container views, SwiftUI has launched a Format protocol this 12 months. Right here’s one tweet displaying find out how to leverage it:

To dynamically change the kind of the structure container with out recomposing its subviews, we’ve received a brand new AnyLayout struct:

Wish to create views which can be equally spaced radially? Right here’s a tweet that exhibits find out how to use _CircleLayout — which is presently personal.

Beforehand, Xcode would autocomplete argument labels of a operate/initializer even when it was already written — resulting in redundancy. Xcode 14 handles that extra effectively as demonstrated within the beneath tweet:

A LabeledContent view helps you to add a label to any view — with out going nested the HStackVStack approach. What’s extra? It’s good for accessibility too!

With iOS 16, SwiftUI has deprecated NavigationView in favor of NavigationStack. Additionally, there’s a NavigationPath to programmatically retailer and modify the route stack:

Moreover, it’s really easy to arrange deep hyperlinks and handoffs as showcased in Majid’s tweet.

Now you can faucet a view and get its location — world or native (native is relative to its tremendous view). Right here’s a useful demonstration of the SpatialTapGesture for prototyping:

So as to add extra results to SwiftUI views, we will now leverage inside shadows like:

Circle().fill(.crimson.gradient.shadow(.inside(radius: 10)))

Paul demonstrated find out how to use it alongside CoreMotion to deliver a 3D impact to your views:

That rounds up the heart beat of SwiftUI Twitterati for WWDC 22. I can’t wait to see the wonderful apps we will construct utilizing the brand new options.

More Posts