Skip to main content

What’s new in Swift

 

There is a lot of news in Binary sizes, Dirty memory, Heap Usage but I want to focus on language. Here I will describe few new classes etc. from Swift 5.3

So here we go 😃

Multiple trailing closure syntax (SE-0279)

From line 7 you have the new, shortest version on the very same code.

Since its inception, Swift has supported something called trailing closure syntax that lets you pop the final argument to a method out of the parentheses when it’s a closure.

It can be more concise and less nested without the loss of clarity, making the call site much easier to read.

Since its inception, Swift has supported something called trailing closure syntax that lets you pop the final argument to a method out of the parentheses when it’s a closure.

It can be more concise and less nested without the loss of clarity, making the call site much easier to read.

Since its inception, Swift has supported something called trailing closure syntax that lets you pop the final argument to a method out of the parentheses when it’s a closure.

It can be more concise and less nested without the loss of clarity, making the call site much easier to read.

However, the restriction of trailing closure syntax to only the final closure has limited its applicability.

KeyPath Expressions as Functions (SE-0249)

Image for post

You can use an KeyPath expression as a function. This means you can pass an KeyPath argument to any function parameter with a matching signature, and you can delete any duplicate declarations you may have added in the past in order to accept KeyPaths.

@main (SE-0281)

In Swift 5.3, this feature has been generalized and democratized.

If you’re a library author, just declare a static main method on the protocol or superclass you expect your users to derive their entry point from.

Image for post
Image for post
Image for post

This will enable your users to tag that type with @main and the compiler to generate an implicit main.swift on their behalf.

This standardized way to delegate a program’s entry point should make it easier to get up and running, whether you’re working on a command-line tool or an existing application.

Multipattern Catch Clauses (SE-0276)

Image for post

The grammar of catch clauses has been extended, providing for the full power of switch cases. This allows you to flatten the kind of multiclause pattern matching directly into the do catch the statement, making it much easier to read.

These are the most important changes in my opinion, for mo check out Apple’s documentation at developer.apple.com

Comments

Popular posts from this blog

How to build FAQ Chatbot on Dialogflow?

  After Google I/O I’m inspired and excited to try new APIs and learn new stuff from Google. This time I decided to try Dialogflow and build a Flutter Chatbot app that will answer some frequently asked questions about Dialogflow. This time I want to be focused more on Dialogflow rather than Flutter. Firstly, go to  Dialogflow ES console , create a new Agent, specify the agent’s name, choose English as a language and click “Create”. As you created a new agent go to setting and enable beta features and APIs and Save. Now let’s model our Dialogflow agent When you create a new Dialogflow agent, two default intents will be created automatically. The  Default Welcome Intent  is the first flow you get to when you start a conversation with the agent. The  Default Fallback Intent  is the flow you’ll get once the agent can’t understand you or can not match intent with what you just said. Click  Intents > Default Welcome Intent Scroll down to  Responses ....

Flutter 2 is here! What’s new?

  Flutter 2 is finally released. And it has a bunch of new stuff! As my core tech for this year is Flutter and automation (wait for it) I will write about it a lot! Here I want just to start the journey and show you the coolest news in Flutter 2 Web support Flutter’s web support has transitioned from beta to the stable channel. With this initial stable release, Flutter pushes the reusability of code to another level with the support of the web platform. So now when you create a Flutter app that is stable, the web is just another device target for your app. Find more details about this stable release in  Flutter’s web support blog post . Desktop The ReorderableListView now has grab handles for easy drag ’n’ drop with a mouse In this release, It was announced that Flutter’s desktop support is available in the stable channel under an early release flag. What this means is that we’re ready for you to give it a try as a deployment target for your Flutter apps: you can think of it a...

What’s new in ARKit 4

  Here it is. The latest version of Apple’s Augmented Reality framework,  ARKit 4 , has just been announced at  WWDC 2020 . Let’s see what’s new in ARKit 4 and for Augmented Reality app development on iOS.  If you’re more inquisitive I linked all stuff directly to Apple documentation. Location anchors ARKit  location anchors  allow you to place virtual content in relation to anchors in the real world, such as points of interest in a city, taking the AR experience into the outdoors.   By setting geographic coordinates (latitude, longitude, and altitude) and leveraging data from Apple Maps, you can create AR experiences linked to a specific world location. Apple calls this process “visual localization”, basically locating your device in relation to its surroundings with a higher grade of accuracy.   All iPhones & iPad with at least an A12 bionic chip and GPS are supported. Depth API The new ARKit  depth API , coming...