Cookie Consent by Free Privacy Policy Generator Aktuallisiere deine Cookie Einstellungen ๐Ÿ“Œ Before WWDC 2024: Reviewing Key SwiftUI Upgrades from 2019 to 2023 and Their Impact


๐Ÿ“š Before WWDC 2024: Reviewing Key SwiftUI Upgrades from 2019 to 2023 and Their Impact


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

When people reunite after a long absence, they are often surprised by the changes in each other; however, the transformations in those who are with us day after day are often overlooked. In this article, I will sift through the key updates to SwiftUI that have made a significant impression on me since its first version. This is not only a reflection on the evolution of SwiftUI from its inception to its maturity but also a fresh appreciation of the vitality it embodies.

Each update to SwiftUI has brought numerous new features and capabilities. In this text, I will focus primarily on those changes that have had a profound impact on me personally and discuss other frameworks and features closely related to SwiftUI and the Apple ecosystem, demonstrating how they collectively shape the platform we use today.

Donโ€™t miss out on the latest updates and excellent articles about Swift, SwiftUI, Core Data, and SwiftData. Subscribe to Fatbobmanโ€™s Swift Weekly and receive weekly insights and valuable content directly to your inbox.

2019

Despite its initially limited functionality, the first version of SwiftUI showcased some core featuresโ€”such as its declarative syntax, reactive mechanisms, and layout logicโ€”that have persisted through today with almost no changes across multiple versions. This not only proves the thoughtful consideration Apple gave when designing SwiftUI but also highlights the forward-thinking nature of its philosophy and architectural design.

The framework's name itself illustrates the inseparable connection between SwiftUI and the Swift programming language, a relationship that has been continually strengthened and validated with each subsequent update. SwiftUI leverages the features and advantages of Swift, and conversely, the development of Swift has also been influenced to some extent by the evolution of the SwiftUI framework.

Released alongside SwiftUI was the Combine framework, which provides powerful control over asynchronous data streams. SwiftUI uses it to implement an observation mechanism for reference types. Combine has enabled Apple and third-party developers to conveniently transform existing APIs into reactive APIs that support SwiftUI. However, due to Combine's inability to offer high-precision observation capabilities, SwiftUI faced significant performance issues in certain scenarios, which were not addressed until the introduction of the Observation framework last year.

Also launched at WWDC 2019 was Core Data with CloudKit, giving new life to Core Data and offering a unique and powerful advantage for applications within the Apple ecosystem. Many developers have embraced Core Data, largely attracted by its convenient and free data synchronization capabilities.

Although the initial version of SwiftUI may seem naive from today's perspective, as a declarative and reactive framework introduced by Apple, it has fully demonstrated its uniqueness and potential.

2020

  • New Project Templates: Xcode introduced new project templates for SwiftUI, allowing developers to more easily create complete app entries using the App and Scene protocols. Additionally, this update brought SwiftUI support for macOS development and introduced multi-window capabilities on iPad.
  • Numerous New Lazy Containers: This version introduced a variety of lazy containers such as LazyVStack, LazyHStack, LazyVGrid, and LazyHGrid. These containers offer more flexible layout options and are natively implemented in SwiftUI, independent of any specific UIKit/AppKit components. Unfortunately, these native lazy containers still have some performance issues, and many developers are eager for the development team to resolve these soon.
  • @StateObject: The introduction of @StateObject addressed the instability issues with the lifecycle of reference type instances that were previously observed with @ObservedObject.
  • onChange: The onChange modifier enhances developers' ability to execute logic in response to specific state changes within views, further reinforcing SwiftUI's unique take on declarative programming. This includes embedding some lightweight imperative logic directly into the function-based UI declarations. Although this design philosophy has its pros and cons, it also provides unique advantages to SwiftUI.
  • Scrolling Positioning: ScrollViewReader offers a method for positioning within scroll views using id and anchor, fully reflecting SwiftUIโ€™s philosophy of layout: based on view identity and not reliant on absolute positioning.
  • Introduction of Widgets: Starting with iOS 14, Apple introduced WidgetKit, a framework specifically designed for building widgets. WidgetKit requires developers to use SwiftUI to construct these widgets, a change that significantly encouraged developers who were initially hesitant about adopting SwiftUI to begin actively learning and using it.

At WWDC 2020, Core Data with CloudKit introduced synchronization features for public databases, further expanding its potential for data management and multi-device synchronization.

Following WWDC 2020, SwiftUI now has the fundamental capabilities needed to build a complete application. In less complex application scenarios, developers can almost avoid using UIViewRepresentable to wrap UIKit components.

2021

  • Integration of the new concurrency model: With the release of Swift 5.5, a new concurrency model was introduced to Swift. SwiftUI leverages the task, task(id:), and refreshable modifiers to provide a convenient context for this new concurrent code, significantly simplifying the complexity of asynchronous programming.
  • Focus management based on view hierarchy: With @FocuseState, SwiftUI not only completed the previously missing text input focus management features but also elevated focus management to a new level. Developers can now manage multiple focus transitions and detect focus states across the entire view hierarchy. This unified focus management feature left a profound impression on me as it not only fulfills basic functionalities but also provides an optimal solution in line with the philosophy of SwiftUI.
  • Integration of FormatStyle: With the introduction of new Formatter APIs by Swift's Foundation, SwiftUI has supported these formatting interfaces in Text and TextField components. This allows developers to control the formatted input and output of text more conveniently through FormatStyle, greatly enhancing the expressiveness and readability of the code. However, there is currently a limitation in using FormatStyle in TextField: it cannot apply formatters in real-time during user input. This is an area where SwiftUI needs to improve in future versions.
  • Support for AttributedString: The support for AttributedString in SwiftUI significantly enhanced the functionality and flexibility of the Text component for displaying text. This change provides developers with a more diverse range of text processing options, greatly enriching the user interface's expressiveness. However, despite the significant enhancements brought by AttributedString, there have been no similar-scale features introduced since its inclusion. More regrettably, TextField and TextEditor still do not support AttributedString to this day, limiting these controls' ability to handle complex text formats.
  • Dynamic modification of fetch conditions: This update introduced the ability to dynamically adjust fetch conditions in @FetchRequest, allowing developers to modify conditions without needing to create additional wrapper views. However, the @Query property wrapper introduced for SwiftData in 2023 does not yet have this capability.

At WWDC 2021, Core Data with CloudKit introduced data sharing capabilities, completing the three major features of Core Data with CloudKit.

It can be said that in 2021, the many enhancements SwiftUI received were closely related to the updates of Swift and Swift Foundation that year.

2022

  • Layout Protocol: The introduction of the Layout protocol not only provided developers with the ability to create custom layout containers but also deeply demonstrated SwiftUI's layout mechanism based on negotiation. This protocol has enhanced developers' understanding of SwiftUI's layout logic. The new Grid component, as well as existing layout components such as VStack and HStack, have been updated to conform to the Layout protocol and support AnyLayout, significantly increasing layout flexibility. Currently, the Layout protocol does not support the creation of lazy containers; we look forward to future versions expanding and refining this capability.
  • New Programmatic Navigation: NavigationStack and NavigationSplitView introduced a new programmable navigation system, fundamentally improving previous limitations with SwiftUI navigation. This change has led many developers to set the minimum system requirements for SwiftUI projects to iOS 16 to utilize these new navigation features.
  • Swift Charts: Apple's introduction of the Swift Charts framework for SwiftUI has set new standards in the industry for construction methods, visual effects, and integration with SwiftUI. In its second-year update, the framework added more chart types and support for interaction, further extending its functionality. Swift Charts has now become a top choice for chart applications within the Apple ecosystem, enhancing the significance and practicality of SwiftUI itself.
  • Enhanced macOS Support: This version significantly improved support for macOS, particularly in handling WindowGroup as well as Settings and MenuBarExtra. From this version onward, SwiftUI's capabilities in building macOS applications have been substantially enhanced.

The updates in 2022 brought many significant improvements to SwiftUI, especially the Layout protocol and the new navigation system, which have profound implications for the future development of SwiftUI applications.

2023

  • New Observation Framework: With the release of Swift 5.9, the newly introduced Observation framework provides the ability to observe properties of observable objects, fundamentally solving the issue of excessive invalid updates in SwiftUI views caused by insufficient precision in Combine observations. The full adoption of Observation has significantly improved application efficiency. Moreover, this update has simplified the declaration and injection of state in SwiftUI; developers can now manage various states simply using @State and Environment, without relying on Combine.
  • Revolutionary Upgrades in Animation and Visual Effects: The 2023 update brought a range of innovative features to SwiftUI, including animation completion callbacks, phase animations, keyframe animations, and new Transition and Shape protocols, along with support for Shaders. These features have significantly enhanced developers' freedom in creating animations and visual effects. The newly introduced animation and visualEffect modifiers use closures to provide clearer logic handling, effectively reducing the impact on upstream and downstream components of the view tree, guiding the future development of SwiftUI view decorators.
  • Comprehensive Enhancement of Scrollable Containers: Scrollable containers have also been enhanced with many new features, such as scroll indicators, margin adjustments, scroll clipping, and advanced scrolling capabilities independent of ScrollViewReader. Although these individual features might not seem prominent, their collective appearance certainly sparks speculation: could this be laying the groundwork for a major update to lazy container functionalities in the future?
  • SwiftData: The long-awaited SwiftData was finally released, serving as the successor to Core Data. Its code-based modeling approach and tight integration with the Observation framework make it the most suitable data management framework for the SwiftUI era. If the upcoming WWDC 2024 still does not introduce a feature similar to NSFetchedResultsController for external data retrieval (real-time change detection) in SwiftData, it will further confirm Apple's strategic decision to position SwiftUI as the sole UI framework for the future, accelerating this transition.
  • visionOS: With the launch of Apple Vision Pro, it has become the only hardware platform in the Apple ecosystem where native application development exclusively supports SwiftUI. This change indicates that the Apple Vision Pro team will use SwiftUI to build more native applications, a development eagerly anticipated by developers. The widespread adoption of SwiftUI by Apple's official team will promote rapid iteration in fixing issues, enhancing performance, and introducing new features in the framework. I look forward to seeing more official applications developed using SwiftUI on iOS and macOS platforms at this year's WWDC 2024.

2023 has become a pivotal year in the development of SwiftUI, with the introduction of the Observation framework and SwiftData, among other innovative technologies, helping to cement its status as a mainstream development platform.

Looking Ahead to WWDC 2024

In an era where AI becomes a mainstream trend, how will SwiftUI leverage the powerful momentum of AI to achieve breakthrough improvements? At the upcoming WWDC 2024, which will be held in two weeks, I believe we will witness more exciting transformations.

Let's all look forward to the surprises that WWDC 2024 will bring!

The original article was published on my blog Fatbobman's Blog.

...



๐Ÿ“Œ Before WWDC 2024: Reviewing Key SwiftUI Upgrades from 2019 to 2023 and Their Impact


๐Ÿ“ˆ 103.56 Punkte

๐Ÿ“Œ What to expect from WWDC 2024: Siri, AI upgrades, iOS 18, MacOS 15, more


๐Ÿ“ˆ 25.95 Punkte

๐Ÿ“Œ iPhone 13 Pro Concept Imagines Both Good Upgrades and Bad Upgrades โ€“ Video


๐Ÿ“ˆ 25 Punkte

๐Ÿ“Œ Canopy increases speed and accuracy of reviewing protected spreadsheet and tabular data


๐Ÿ“ˆ 24.46 Punkte

๐Ÿ“Œ Before WWDC 2024: The Future Potential and Real Challenges of SwiftData


๐Ÿ“ˆ 24.42 Punkte

๐Ÿ“Œ WWDC 2022: WatchOS 9 upgrades Apple Watch faces, complications, and health tracking


๐Ÿ“ˆ 23.72 Punkte

๐Ÿ“Œ Google Sheets gains a sidebar for making and reviewing comments


๐Ÿ“ˆ 22.94 Punkte

๐Ÿ“Œ Noticing command and control channels by reviewing DNS protocols, (Mon, Nov 13th)


๐Ÿ“ˆ 22.94 Punkte

๐Ÿ“Œ Top 5 Things to Do Before The WWDC 2024 Keynote


๐Ÿ“ˆ 22.89 Punkte

๐Ÿ“Œ Kein AppleGPT zur WWDC? | wann gibtโ€™s neue AirTags? | welche Kamera-Upgrades im iPhone 16? โ€“ Daybreak Apple


๐Ÿ“ˆ 22.2 Punkte

๐Ÿ“Œ Chinese database detailing 2.4 million influential people, their kids, their addresses, and how to press their buttons revealed


๐Ÿ“ˆ 22 Punkte

๐Ÿ“Œ SwiftUI vs. UIKit: What is the best choice for building an iOS user interface in 2024?


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ UK reviewing its cyber security after US election hacks


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ UK reviewing its cyber security after US election hacks


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Microsoft reviewing sexual harassment claims as employee complaints surge


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Microsoft now reviewing Skype audio in โ€˜secureโ€™ places (not China)


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Tizen Tidbits: Reviewing More UI Samples


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Why Mainstream Media Should Stop Reviewing Videogames


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ NSA Admits They're Reviewing Government Use of Kaspersky Software


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Amazon 'Reviewing' Its Website After It Suggested Bomb-Making Items


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ US Reviewing Better Tech Identifiers After Hacks: Trump Aide


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ 5 Ways I Provide Value as a PullRequest Reviewer When I Start Reviewing a New Project


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ IEEE Bans Huawei From Peer-Reviewing Papers, Chinese Scientists Quit To Protest


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ IEEE Bans Huawei From Peer-Reviewing Papers, Chinese Scientists Quit To Protest


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ The Top 5 Most Common Security Issues I Discover When Reviewing Code


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Reviewing Pop!_OS on different hardware configurations


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Beware Public Wi-Fi Insecurity โ€“ Part 1: Reviewing the Neighborhood


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ IEEE Is No Longer Banning Huawei Scientists From Peer-Reviewing Papers


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Small ISP Cancels Data Caps Permanently After Reviewing Pandemic Usage


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Israel's Justice Ministry Reviewing Cyber Incident After Hacktivists Claim Breach


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ Reviewing 10 lines of code vs. 500 lines of code


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ WORKFORCE STUDY: REVIEWING CYBERSECURITYโ€™S PANDEMIC RESPONSE


๐Ÿ“ˆ 21.42 Punkte

๐Ÿ“Œ What is cybersecurity testing? Reviewing testing tools, methodologies for proactive cyber readiness


๐Ÿ“ˆ 21.42 Punkte











matomo