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

0
28

Echoing the new features through tweets

Photo by Rubaitul Azad on Unsplash

Now that the euphoria of WWDC 22 has subsided, here’s a look at some of the best tweets to help you get a pulse of most developer announcements from the event.

Starting iOS 16, we now have a Charts framework to easily create a Bar, Line, Area, Point, or Rule chart with customizable axis, and legends.

See how to annotate a PointMark SwiftUI chart with almost any view – in the below case, using SF Symbols:

For Linear gradients with the same color, you need not use the LinearGradient constructor anymore. Paul shows how to invoke gradient on a color to directly bring that effect to your views:

My favorite new SwiftUI feature is the ability to export views as images by using the ImageRenderer.

But do you know how to match the view’s resolution? Luckily, there’s a scale property that you can call on the ImageRenderer instance as demonstrated in the below tweet by Daniel:

We can directly set the editable list options – like swipe to delete or reorder inside the new init function’s edits argument:

A context menu with a preview that displays on top of the menu? You’ve got it:

A built-in SF Symbols search within Xcode 14 is a welcome addition. But the new variable color feature upons so many opportunities to display state-driven symbols… like a progress indicator as shown in the below tweet:

Out-of-the-box support for Grids would surely help build more complex layouts in SwiftUI. Like the below tweet demonstrates (with gist sample) shows how to use Grids with SF Symbols and Timeline view.

To build custom container views, SwiftUI has released a Layout protocol this year. Here’s one tweet showing how to leverage it:

To dynamically change the type of the layout container without recomposing its subviews, we’ve got a new one AnyLayout struct:

Want to create views that are equally spaced radially? Here’s a tweet that shows how to use _CircleLayout – which is currently private.

Previously, Xcode would autocomplete argument labels of a function / initializer even when it was already written – leading to redundancy. Xcode 14 handles that more efficiently as demonstrated in the below tweet:

A LabeledContent view lets you add a label to any view – without going nested the HStackVStack way. What’s more? It’s good for accessibility too!

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

Furthermore, it’s so easy to set up deep links and handoffs as showcased in Majid’s tweet.

You can now tap a view and get its location – global or local (local is relative to its super view). Here’s a handy demonstration of the SpatialTapGesture for prototyping:

To add more effects to SwiftUI views, we can now leverage inner shadows like:

Circle().fill(.red.gradient.shadow(.inner(radius: 10)))

Paul demonstrated how to use it alongside CoreMotion to bring a 3D effect to your views:

That rounds up the pulse of SwiftUI Twitterati for WWDC 22. I can not wait to see the amazing apps we can build using the new features.

Source

LEAVE A REPLY

Please enter your comment!
Please enter your name here