Welcome to another issue!
Subscribe to another newsletter I run!
3750 subscribers already! π
Weekly newsletter featuring the best tools for iOS developers. Subscribe π iOS Dev Tools Newsletter
Swift Around the Web
New GitHub Organization for the Swift Project
The Swift programming language is migrating to a dedicated GitHub organization at: github.com/swiftlang. This announcement, made on June 10, 2024, reflects the language's growing maturity and widespread adoption beyond Apple's ecosystem.
The initial phase of the migration will focus on core elements:
- Compiler and core tools
- Standard libraries and core APIs
- Samples
- The Swift.org website
- Official clients, drivers, and other packages (coming soon)
This initiative signifies a community-driven effort paving the way for a more collaborative and robust future for Swift.
Getting Started with Swift Testing in iOS 18 and Xcode 16
This post guides you through creating unit tests using Swift Testing, a new framework introduced in iOS 18 and Xcode 16.
Benefits of Swift Testing:
- More descriptive test names and comments.
- Support for tags to organize tests.
- Ability to use parameters within tests.
- Error type checking with Swift 6.
Overall, this post provides a clear introduction to Swift Testing, making it easier for developers to write more expressive and maintainable unit tests.
Coding
Whatβs New in Xcode 16
Xcode 16 brings a wave of enhancements for developers:
- Smarter Editing: Enhanced code completion (macOS Sequoia), Swift 6 integration, and streamlined previews.
- Faster Builds & Debugging: Explicit modules, quicker packages, clearer errors, DWARF5 support, and advanced thread checking.
- Testing & Performance Boosts: Expressive Swift Testing framework, StoreKit testing, and Flame graph analysis.
- More Efficiency: Faster file creation, FaceTime/SharePlay in simulators, dark/tinted app icons (iOS), and improved Xcode Cloud & localization.
Xcode 16 empowers developers with a more efficient and enjoyable development experience which is in beta.
Using App Intents in a SwiftUI app
This tutorial demonstrates adding App Intents to a SwiftUI movie app. With that users can perform key actions (adding/rating movies) from anywhere on their iPhone using Siri, Spotlight, or the Shortcuts app.
Core Steps:
- Define a model (MovieItem) to store movie data.
- Create a view (ContentView) to display the movie list.
- Build logic (MovieViewModel) to manage movie data (adding/rating).
- Create Intents (AddMovieIntent, MovieRatingIntent) for adding and rating movies.
- Make data types (MovieItem, MovieRating) compatible with App Intents.
- Expose Intents to Spotlight search (MovieAppShortcutProvider).
SwiftUI: Little Twists for NavigationTransition Introduced in WWDC 2024
Article explores SwiftUI's new NavigationTransition feature introduced in WWDC 2024.
Key Points:
- Zoom Animations: Create smooth zoom transitions between views using NavigationTransition.
- Source View Definition: Use matchedTransitionSource to identify the view initiating the animation.
- Single Source Limitation: Currently, only one source view can be animated per transition.
Simplifies zoom animation implementation within NavigationStack but also it is limited to zoom animations.
Zoom navigation transition in SwiftUI
WWDC 2024 introduced a new NavigationTransition protocol with a built-in zoom animation for SwiftUI.
This simplifies adding zoom transitions between views. While currently limited to zoom and lacking customization options, it's a promising addition for smoother navigation experiences.
The post includes an example using a grid view transitioning to a detail view with zoom.
AsyncImage in SwiftUI: Loading Images from URLs
AsyncImage, a SwiftUI view for loading images from URLs, simplifies fetching remote images. While convenient, it doesn't cache images by default.
Here's how to use AsyncImage effectively:
- Load images with a URL.
- Resize and display placeholders during loading.
- Handle errors with custom views.
Benefits:
- Gain more control over image management.
- Potentially improve app performance with caching.
Enhanced replace transition for SF Symbols in iOS 18
iOS 18 introduces "MagicReplace'' for SF Symbols, automatically animating slashes and badges for smoother visual transitions.
- Automatically applied: Works seamlessly with related SF Symbols, especially useful for tappable elements like toggles.
- Enhanced animations: Provides a smoother transition when adding or removing slashes on symbols.
- Explicit control: Optionally specify "MagicReplace" with a fallback transition for more control.
visionOS
Creating custom buttons and hover effects in visionOS
Use hover effects and visual feedback to enhance your appβs interactivity with system and custom buttons.
Key Points: - Prioritize system buttons for built-in hover effects and animations. - Use custom buttons for unique designs, but ensure they include hover effects and animations for a responsive interface. - Apply hoverEffect for visual cues on interaction. - Use contentShape to define the hover effect area for complex layouts.
This hover effect effectively makes your visionOS apps more intuitive and visually appealing.
Other Cool Stuff
Present a form sheet in SwiftUI
SwiftUI now simplifies presenting form sheets (like those on iPad) with the new presentationSizing(.form) modifier.
- Presenting form sheets is now a breeze.
- .form sizing ensures a perfect fit on larger devices.
- Even tailor sheet size for specific design needs.
SwiftUI streamlines form sheet creation for a more intuitive development experience.
In Case You Missed It
SwiftUI Pie Charts
This SwiftUI guide explores creating pie charts in iOS 17 using the new SectorMark.
- Basics: Define slices with SectorMark and data value for angles. Set colors with foregroundStyle.
- Data Binding: Provide category and value data in structs. Use Chart initializer with data closure.
- Customization: Control size, donut shape, and slice separation. Add polish with corner radius and legend.
- Interactivity: Track selections with State and chartAngleSelection. Highlight selected slices and update center view.
SwiftUI offers a powerful and customizable approach to creating informative pie charts for your iOS apps.
Videos
The Talk Show Live From WWDC 2024
The Talk Show features John Gruber with special guests John Giannandrea, Craig Federighi, and Greg Joswiak. They delve into Apple's major announcements at WWDC 2024, recorded live in San Jose.
The discussion likely covers updates across Apple's platforms (iOS, iPadOS, macOS, etc.) presented by Craig Federighi and Greg Joswiak, followed by a segment on Apple Intelligence, potentially a new AI initiative, led by John Giannandrea.