Sponsored Link
RUNWAY
Every mobile release follows the same cycle with the same collection of questions and (often) the same frustrating problems that crop up along the way.
You can resign yourself to wasted time, context switching, and stress. Or you can do the opposite of that. Start by reading our white paper.
Swift Around the Web
How to automatically detect memory leaks on CI/CD using UI tests
This post by Pol outlines a method to automatically detect memory leaks in iOS apps during CI/CD. By leveraging Xcode 13's enablePerformanceTestsDiagnostics flag and creating a custom tool to analyze memory graphs from UI tests, developers can identify and address memory issues early in the development process.
Coding
Customizing windows in SwiftUI
SwiftUI provides tools to customize window behavior and appearance. You can set default window size and control resizability using defaultSize and windowResizability.
For precise placement, use defaultWindowPlacement to position windows on different platforms. Additionally, WindowDragGesture allows you to handle window movement interactions.
The Translation framework for language-to-language translation
The Translation framework enables in-app text translation using on-device ML models. Configure a TranslationSession with desired languages, then use the translationTask modifier to perform translations.
The framework handles downloading necessary language models. You can also pre-download models using prepareTranslation for faster translations.
@Entry macro: Creating custom environment values in SwiftUI
The @Entry macro simplifies creating custom environment values in SwiftUI. It eliminates boilerplate code, making it easier to share data across views.
By defining environment values using @Entry, you can access them using @Environment and achieve a cleaner data flow in your app.
Truncating Text In SwiftUI
Explore different methods for truncating text in SwiftUI. You can limit text display based on lines using lineLimit and control truncation behavior with truncationMode.
Alternatively, you can truncate by character count using prefix, suffix, or custom substring extraction. The post also demonstrates how to expand and collapse truncated text using state management.
Migrating KeyboardKit to Swift 6 language mode
Migrating KeyboardKit to Swift 6 highlighted challenges in handling UIViewController and UIView initialization, global UIKit constants, and protocol interposers under strict concurrency.
While the overall migration was smooth due to the framework's focus on the main thread, these issues required workarounds and exposed limitations in Swift's concurrency model.
Design
Scrolling pickers in SwiftUI
Build a custom scrolling picker in SwiftUI using ScrollView.
The post includes:
- Dynamic segment generation and styling
- Precise scrolling control with scrollTargetBehavior
- Haptic feedback for selection
- Binding for value output
By leveraging SwiftUI's scrollTransition and sensoryFeedback modifiers, the picker achieves a polished and responsive user experience.
Other Cool Stuff
Conditional Breakpoints are Slow
This post details a debugging journey to uncover a performance issue caused by a conditional Swift Error breakpoint interacting with GRDB's error handling.
The unexpected slowdown was resolved by disabling the breakpoint, highlighting the potential performance impact of such breakpoints and the importance of considering them when troubleshooting performance issues.
In Case You Missed It
Embedded Swift Tutorial - Getting Started
Guide about the basics of Embedded Swift development using an ESP32 microcontroller.
Learn to set up your environment, including Swift toolchain and ESP-IDF, and build your first Swift firmware. Discover recommended hardware options and troubleshoot common issues.
Swift Type Attributes
Learn more about the Swift type attributes, providing a comprehensive explanation of their purpose and usage. It covers essential attributes like @escaping, @Sendable, @MainActor, and @autoclosure.
Through code examples and explanations, the author clarifies how these attributes influence function behavior, particularly in the context of concurrency and asynchronous programming.
Videos
Problem with Swift 6 Concurrency, List vs. ScrollView, App Intents, LazyVGrid & More
Sean Allen discusses the challenges of migrating to Swift 6, including data race safety issues. It provides insights into new SwiftUI features like LazyVGrid and SF Symbols, along with best practices for using List vs ScrollView.
The speaker also analyzes app revenue trends, discusses the impact of iOS 18 dark and tinted app icons, and explores opportunities in macOS development.
Understanding frames and coordinates in GeometryReader of SwiftUI
This video explains how to use GeometryReader to dynamically adjust view layouts based on available space. It covers coordinate spaces (global, local, custom), and demonstrates practical use cases through code examples.