-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-iOS: new WWDC23 video {'What’s new in Swift'}.
- Loading branch information
Showing
27 changed files
with
229 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
--- | ||
title : "What’s new in Swift" | ||
abstract: "Discover powerful enhancements to the trait system in UIKit." | ||
|
||
displayToc: true | ||
--- | ||
|
||
# WWDC 2023: What’s new in Swift | ||
Find hereafter a detailed summary of a video that belongs to a [taxonomy of some WWDC footages](../../). | ||
|
||
The original video is available on the **Apple official website** ([session 10164](https://developer.apple.com/videos/play/wwdc2023/10164/)). | ||
![](../../../../../images/iOSdev/wwdc23-10164_Poster.png) | ||
"Join us for an update on Swift. We'll show you how APIs are becoming more extensible and expressive with features like **parameter packs and macros**. We'll also take you through improvements to interoperability and share how we're expanding **Swift's performance and safety benefits** everywhere from Foundation to large-scale distributed programs on the server." | ||
</br>Hereafter, the underlined elements lead directly to the playback of the WWDC video at the appropriate moment. | ||
</br> | ||
![](../../../../../images/iOSdev/wwdc23-10164_1.png) | ||
The `Swift` [open source project](https://developer.apple.com/videos/play/wwdc2023/10164/?time=40) has set up some changes in its operating mode to head towards a more efficient collaborative work. | ||
</br> | ||
|
||
## [Expressive code](https://developer.apple.com/videos/play/wwdc2023/10164/?time=164) | ||
### [If/else & switch](https://developer.apple.com/videos/play/wwdc2023/10164/?time=172) | ||
These two statements can be used as **expressions** to streamline the code writing. | ||
![](../../../../../images/iOSdev/wwdc23-10164_2.png) | ||
</br> | ||
### [Result builder](https://developer.apple.com/videos/play/wwdc2023/10164/?time=231) | ||
![](../../../../../images/iOSdev/wwdc23-10164_3.png) | ||
</br> | ||
### [Type parameter pack](https://developer.apple.com/videos/play/wwdc2023/10164/?time=294) | ||
**The combination of the argument length with some abstraction types** may be reached through the use of `Any` as the type information with the variadic parameters but `Swift` `5.9` highlights a new concept called the **type parameter pack** to suggest a more elegant way of coding this use case. | ||
![](../../../../../images/iOSdev/wwdc23-10164_4.png) | ||
To increase the generics range, it could be interesting to add some **protocol** conformances to the initial types in order to work directly with them instead of types themselves. | ||
</br> | ||
### Macros | ||
<ul class="nav nav-tabs" role="tablist"> | ||
<li class="nav-item" role="presentation"> | ||
<a class="nav-link active" | ||
data-bs-toggle="tab" | ||
href="#SwiftMacros1" | ||
id="SwiftMacros1_tab" | ||
role="tab" | ||
aria-selected="true">Definition</a> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<a class="nav-link" | ||
data-bs-toggle="tab" | ||
href="#SwiftMacros2" | ||
id="SwiftMacros2_tab" | ||
role="tab" | ||
aria-selected="false">freestanding</a> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<a class="nav-link" | ||
data-bs-toggle="tab" | ||
href="#SwiftMacros3" | ||
id="SwiftMacros3_tab" | ||
role="tab" | ||
aria-selected="false">attached</a> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<a class="nav-link" | ||
data-bs-toggle="tab" | ||
href="#SwiftMacros4" | ||
id="SwiftMacros4_tab" | ||
role="tab" | ||
aria-selected="false">@Observable</a> | ||
</li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<div class="tab-pane show active" id="SwiftMacros1" role="tabpanel"> | ||
|
||
<a alt="Click to playback the footage at the appropriate moment regarding the macro definition" href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=590">🎬</a> | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_5.png) | ||
Introduced in `Swift` `5.9`, the macros `API`s use the hash syntax for creating code that **transforms syntax at compile time**. | ||
![](../../../../../images/iOSdev/wwdc23-10164_6.png) | ||
|
||
They may be defined through [module importing](https://developer.apple.com/videos/play/wwdc2023/10164/?time=695) or in [separate programs](https://developer.apple.com/videos/play/wwdc2023/10164/?time=771).</div> | ||
|
||
<div class="tab-pane" id="SwiftMacros2" role="tabpanel"> | ||
|
||
<a alt="Click to playback the footage at the appropriate moment regarding the freestanding expression macro" href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=812">🎬</a> | ||
|
||
As a possible **role** to be attached to a macro, the **freestanding expression** macro that creates a piece of code returning a value is highlighted through the new [Foundation Predicate](https://developer.apple.com/videos/play/wwdc2023/10164/?time=833) APIs. | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_7.png) | ||
</div> | ||
|
||
<div class="tab-pane" id="SwiftMacros3" role="tabpanel"> | ||
|
||
<a alt="Click to playback the footage at the appropriate moment regarding the attached macros" href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=886">🎬</a> | ||
|
||
Using the same syntax as property wrappers, the goal of an **attached macro** is to add very condensed code information while authoring with the at sign. | ||
![](../../../../../images/iOSdev/wwdc23-10164_8.png) | ||
|
||
[Multiple roles](https://developer.apple.com/videos/play/wwdc2023/10164/?time=953) can also be assigned to this type of macro. | ||
![](../../../../../images/iOSdev/wwdc23-10164_9.png) | ||
</div> | ||
|
||
<div class="tab-pane" id="SwiftMacros4" role="tabpanel"> | ||
|
||
<a alt="Click to playback the footage at the appropriate moment regarding the new observable object" href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=1017">🎬</a> | ||
|
||
Composed of different macro roles, the **new Observable macro** generates a SwiftUI dependencies automation for read properties with no needed wrapper. | ||
![](../../../../../images/iOSdev/wwdc23-10164_10.png) | ||
For quickly reaching the code regarding a [macro expansion](https://developer.apple.com/videos/play/wwdc2023/10164/?time=1114), it'll come handy to use the **new `Xcode` `15` feature** suggested in the menu when the macro is selected. | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_11.png) | ||
</div> | ||
</div> | ||
</br> | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_12.png) | ||
</br> | ||
|
||
## [Dates & JSON](https://developer.apple.com/videos/play/wwdc2023/10164/?time=1192) | ||
**Dates** calculation and formatting plus **`JSON`** handling have been improved in `Swift` `5.9`. | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_13.png) | ||
</br> | ||
|
||
## [Ownership](https://developer.apple.com/videos/play/wwdc2023/10164/?time=1415) | ||
This new concept introduces many enhancements **for structs and enums**: | ||
- Remove the **copyable** default implementation if need be ⟹ <a alt="Click to playback the video footage." href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=1537">🎬</a> | ||
|
||
- Add **consuming methods** that can be played only once and that invalidate the value after the method has been run ⟹ <a alt="Click to playback the video footage." href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=1595">🎬</a> | ||
|
||
- Add a **deinit** like classes ⟹ <a alt="Click to playback the video footage." href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=1575">🎬</a> | ||
|
||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_14.png) | ||
## [C++ interoperability](https://developer.apple.com/videos/play/wwdc2023/10164/?time=1679) | ||
<ul class="nav nav-tabs" role="tablist"> | ||
<li class="nav-item" role="presentation"> | ||
<a class="nav-link active" | ||
data-bs-toggle="tab" | ||
href="#SwiftC++1" | ||
id="SwiftC++1_tab" | ||
role="tab" | ||
aria-selected="true">Xcode</a> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<a class="nav-link" | ||
data-bs-toggle="tab" | ||
href="#SwiftC++2" | ||
id="SwiftC++2_tab" | ||
role="tab" | ||
aria-selected="false">Using C++ from Swift</a> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<a class="nav-link" | ||
data-bs-toggle="tab" | ||
href="#SwiftC++3" | ||
id="SwiftC++3_tab" | ||
role="tab" | ||
aria-selected="false">Using Swift from C++</a> | ||
</li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<div class="tab-pane show active" id="SwiftC++1" role="tabpanel"> | ||
|
||
<a alt="Click to playback the footage at the appropriate moment regarding the xcode side" href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=1714">🎬</a> | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_15.png) | ||
</div> | ||
|
||
<div class="tab-pane" id="SwiftC++2" role="tabpanel"> | ||
|
||
<a alt="Click to playback the footage at the appropriate moment regarding the use of c++ from swift" href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=1733">🎬</a> | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_16.png) | ||
</div> | ||
|
||
<div class="tab-pane" id="SwiftC++3" role="tabpanel"> | ||
|
||
<a alt="Click to playback the footage at the appropriate moment regarding the use of swift from c++" href="https://developer.apple.com/videos/play/wwdc2023/10164/?time=1791">🎬</a> | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_17.png) | ||
</div> | ||
</div> | ||
</br> | ||
</br> | ||
|
||
## [CMake support](https://developer.apple.com/videos/play/wwdc2023/10164/?time=1894) | ||
|
||
`Swift` support in `CMake` has been improved in order to encompass `C++` and `Swift` within a single target. | ||
![](../../../../../images/iOSdev/wwdc23-10164_18.png) | ||
</br> | ||
|
||
## [Concurrency](https://developer.apple.com/videos/play/wwdc2023/10164/?time=1960) | ||
![](../../../../../images/iOSdev/wwdc23-10164_19.png) | ||
</br> | ||
|
||
### [Tasks](https://developer.apple.com/videos/play/wwdc2023/10164/?time=2020) | ||
![](../../../../../images/iOSdev/wwdc23-10164_20.png) | ||
</br> | ||
|
||
### [Actors](https://developer.apple.com/videos/play/wwdc2023/10164/?time=2081) | ||
![](../../../../../images/iOSdev/wwdc23-10164_21.png) | ||
|
||
The **custom actor executors** are an appropriate way to introduce a [dedicated dispatch queue](https://developer.apple.com/videos/play/wwdc2023/10164/?time=2130) for instance. | ||
|
||
![](../../../../../images/iOSdev/wwdc23-10164_22.png) | ||
|
||
This [actors synchronization](https://developer.apple.com/videos/play/wwdc2023/10164/?time=2203) comes in handy thanks to the conformance of the **SerialExecutor protocol** that include new methods in `Swift` `5.9`. | ||
</br> | ||
|
||
### [Foundation DB](https://developer.apple.com/videos/play/wwdc2023/10164/?time=2300) | ||
![](../../../../../images/iOSdev/wwdc23-10164_23.png) | ||
|
||
</br> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters