Fatbobman’s Swift Weekly #021 | Embrace AI, Say Goodbye to Apple Car

fatbobman ( 东坡肘子)
6 min readMar 4, 2024

--

Photo by Andy Wang on Unsplash

Weekly Comment

Recently, Apple Inc. announced at an internal meeting the termination of its ambitious car project “Titan,” marking the official end of this decade-long, costly secret project. With the project’s termination, some employees will be shifted to AI research and development positions to accelerate Apple’s growth in this area. It is reported that Apple plans to integrate more AI features into products such as Siri, Spotlight, and Xcode, hoping that this personnel adjustment will help close the gap with other AI industry leaders.

As a long-term user of Apple products, I have always held reservations about Apple’s foray into the automotive industry. I’ve questioned: Could Apple succeed in manufacturing cars? Would the cars they produce possess enough uniqueness to attract consumers? Although the rise of electric vehicles has lowered the entry barriers to the automobile industry, it has also led to a homogenization issue in the market. Consequently, electric vehicle manufacturers have invested heavily in smart technologies to imbue cars with new features. Given that top electric vehicle manufacturers have been deeply entrenched in this field for many years, Apple faces a significant challenge in creating a car product that could rival the likes of Apple Vision Pro and significantly outperform its competitors.

Moreover, although Apple is experienced in supply chain management, there are hardly any automotive OEMs globally that can meet Apple’s requirements for quality, production volume, and cost simultaneously. In recent years, previously idle capacities have been gradually released, and many companies have entered the electric vehicle market through mergers or acquisitions, launching their own branded cars. Clearly, even if Apple could design an attractive car, producing such a vehicle remains a significant challenge, especially in the current market environment where the electric vehicle industry is generally reducing prices, producing a low-margin product does not align with Apple’s usual business model.

In summary, Apple’s decision to abandon the car project and shift towards strengthening AI research and development might be a strategic self-extrication. As the ancient Chinese saying goes, “A loss may turn out to be a gain ( 塞翁失马,焉知非福 )”, although Apple faces challenges in the AI field, going all out might bridge this gap and prevent obsolescence in the AI era. The inspiration, experience, and patents gained from the car project could unexpectedly benefit other Apple products or services in the future.

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.

Originals

Swift Predicate: Usage, Composition, and Considerations

Fatbobman

NSPredicate has always been a powerful tool provided by Apple, allowing developers to filter and evaluate data collections in a natural and efficient way by defining complex logical conditions. Over time, with the continuous maturation and development of the Swift language, in 2023, the Swift community undertook the task of reconstructing the Foundation framework using pure Swift language. In this significant update, a new Predicate feature based on Swift coding was introduced, marking a new stage in data processing and evaluation. This article aims to explore the usage, structure, and key considerations of Swift Predicate in practical development.

Recent Selections

Dependency Injection for Modern Swift Applications

Lucas van Dongen

In this article, Lucas van Dongen delves into the pivotal role of Dependency Injection (DI) in modern Swift application development and its implementation strategies, emphasizing the importance of accurately implementing DI. The article introduces various DI methods and clearly demonstrates the working principles of each strategy and the challenges they face through diagrams, especially how to properly construct and utilize dependencies throughout the application’s lifecycle. Moreover, it provides a detailed comparison of the Singleton pattern, tree-based structures, containerized methods, and other techniques, discussing their respective advantages and disadvantages. Particularly commendable is the author’s summary of the characteristics of different DI frameworks and the provision of valuable advice on choosing the appropriate DI strategy for projects of different sizes and stages.

How the Swift compiler knows that DispatchQueue.main implies @MainActor

Ole Begemann

Some developers might have noticed that in Swift code, if a function is explicitly marked as @MainActor, its invocation within a DispatchQueue.main.async closure is automatically recognized by the compiler as executing on the main actor. Ole Begemann explores the underlying mechanics of this behavior in this article. This recognition process is implemented during the semantic analysis phase of the Swift compiler, accomplished through a mechanism based on the precise spelling of the source code. While this feature brings convenience to developers, its obscurity increases the difficulty of learning Swift's concurrency. The author suggests that Apple should enhance the visibility of the inferred execution context in Xcode, clearly indicating whether the code is running on the main actor, another actor, or the global cooperative pool, thereby reducing the complexity of Swift concurrency programming and improving the transparency and comprehensibility of the code logic.

Super-Resolution iPhone Panoramas for Vision Pro

David Smith

Although the built-in panorama mode of the iOS Camera app is convenient for capturing panoramic photos, the resulting images often lack a true sense of immersion when viewed on the Apple Vision Pro. In this article, David Smith explores how to enhance the immersive experience on the Vision Pro by taking ultra-high-resolution panoramic photos with an iPhone. He captures a series of 48MP photos using the standard camera mode and then stitches them together in Photoshop to create an ultra-high-definition panoramic image. The processed image, with its astonishing detail and clarity, provides an unparalleled immersive experience on the Vision Pro. David is optimistic about Apple potentially integrating a similar high-resolution panoramic shooting capability into iOS or the iPhone in the future. He speculates that this technology might eventually receive official support, thereby enhancing the viewing experience of panoramic photos in visionOS.

Sharing state in the Composable Architecture

Point-Free

In previous versions of the Composable Architecture (TCA), implementing state sharing between different reducers often posed a challenge, requiring developers to employ various strategies to achieve this goal. This article introduces the latest beta release of TCA by Point-Free, which offers a new tool: the @Shared property wrapper. It supports sharing state across the entire application domain and further provides the capability to persist state to user defaults and the file system. This functionality greatly enriches the flexibility of state management and persistence, making app development based on TCA more efficient and convenient.

How to use VariadicView, SwiftUI’s Private View API

Noah Martin at Emerge Tools

VariadicView provides developers with a flexible way to define container views, enabling the handling of an uncertain number of subviews and allowing for the layout and styling of subviews as needed, which is crucial for creating complex and reusable UI components. This functionality was first revealed by Moving Parts. Although this private API is not publicly documented, it has been validated for safety by numerous well-known applications and is widely used in production environments. In this article, Noah Martin demonstrates how to use this API to develop the SnapshotPreviews framework, which can transform Xcode previews into image snapshots, thereby supporting the integration of automated snapshot testing into pull requests, providing an efficient testing solution for app development.

Type-Driven Design with Swift

Alex Ozun

Type-Driven Design is a refined software development strategy that emphasizes the use of the type system in designing software, particularly suited to functional programming environments. This approach, by making full use of static types, not only ensures the accuracy of the code but also significantly enhances its readability and maintainability, while effectively reducing the likelihood of runtime errors. In the philosophy of Type-Driven Design, types are not merely components of the code but are the crucial pivot around which software systems are built and implemented. Alex Ozun is delving into this method through a series of insightful articles (planned to be nine, with three already published), aiming to guide developers in transforming their Swift programming mindset.

If you found this weekly helpful or enjoyed reading it, consider making a donation to support my writing. Your contribution will help me continue creating valuable content for you.
Donate via Patreon, Buy Me aCoffee or PayPal.

Want to Connect?

@fatbobman on Twitter

--

--

fatbobman ( 东坡肘子)
fatbobman ( 东坡肘子)

Written by fatbobman ( 东坡肘子)

Blogger | Sharing articles at https://fatbobman.com | Publisher of a weekly newsletter on Swift at http://https://weekly.fatbobman.com