Swift Around the Web
Using the #expect macro for Swift Testing
Swift Testing is a newer framework for writing tests in Swift. It uses the #expect macro instead of older assertions like XCTAssertEqual. This makes it easier to debug failed tests because the error messages provide more information. You can also use search patterns in Xcode to help you migrate existing tests to use #expect.
Coding
Mastering container views in SwiftUI, Sections
Article delves into SwiftUI's container views, focusing on how to manage complex layouts with sections. It introduces new features like ForEach(sections:)
and SectionConfiguration
to help break down sections (headers, content, footers) and rebuild them efficiently.
In short, it explains how to create custom container views like a carousel that can handle sections with unique content.
How to build a Safari extension with SwiftUI
Learn how to build a Safari extension with SwiftUI. This guide covers creating a new target, configuring its Info.plist file, and designing the extension's UI using SwiftUI. You'll also learn how to handle events and interact with the Safari browser. By following these steps, you can create useful and user-friendly Safari extensions that enhance your browsing experience.
Discover 3 new features of Xcode 16
Xcode 16 has several new features to improve your development workflow. You can now create new files more easily, find unused assets in your Asset Catalogs, and view the entire stack trace in a single scroll view in the debugger. These features can help you work more efficiently and effectively.
Apple News
Upcoming regional age ratings in Australia and France
Apple is making the App Store safer for kids by implementing regional age ratings in Australia and France.
This means that apps with simulated gambling will be rated R18+ in Australia, and apps with a 17+ global rating will be rated 18+ in France. These changes will be made in the coming months and do not require any action from app developers.
Design
Blending colors dynamically with the mix modifier
SwiftUI's mix(with:by:in:) modifier makes it easy to create custom colors by blending two colors together. You can choose between a perceptual or device color space for different effects.
Additionally, you can create interactive color pickers and sliders to let users customize the blend. This tool is perfect for creating dynamic color schemes that adapt to your iOS 18 app's design.
Other Cool Stuff
Translation's Concurrency Pattern Spells Out the Plank for UIKit
Apple's new Translation framework lets you easily translate text in your SwiftUI app. You can use a popup window or write code to translate. However, it only works with SwiftUI, which might be a problem for developers who prefer UIKit.
This move shows Apple's support for SwiftUI and emphasizes the importance of using concurrency in app development. By combining concurrency and SwiftUI, Apple offers developers a simpler way to create modern apps.
Exploring Cursor: Accessing External Documentation using @Doc
Cursor lets you to access external documentation directly in your workspace. You can add links to documentation and then use the @Doc command or mention the document's name to access the information. As a result, you can work more efficiently and avoid switching tabs all the time.
In Case You Missed It
Getting started with async/await in Swift
Swift's async/await makes asynchronous programming easier. It replaces callbacks with a cleaner, more readable syntax. You can use it with many built-in Swift functions and even convert existing callback-based code. async/await improves code readability and error handling, making your Swift projects more efficient and reliable.
Tutorials
SwiftUI: Present Live Data with Live Activity
This tutorial shows how to use Live Activities in SwiftUI to display real-time data on the Lock Screen and Dynamic Island even when your app isn't open. Users can see important information at a glance and perform actions without launching the app.
It covers creating a widget extension, defining activity attributes, configuring the Live Activity, and managing it in your main app. By following these steps, you can add interactive features to your app that enhance the user experience.
Videos
Experimenting with a Sociotechnical System in Software Engineering
Video by Jessica Kerr emphasizes the importance of experimentation in software development. It highlights that traditional scientific methods are insufficient for understanding complex systems like software development teams. Instead, we need different approaches to experiment effectively and learn from the results.