Welcome to another issue!
I want to share a little secret with you. I'll be launching another newsletter in May. βοΈ
The newsletter will be PAID only and will focus only on "Remote Jobs for iOS Devs". Instead of devs searching for jobs on LinkedIn, Twitter, or other platforms. They will receive two emails per week with the latest job listings.
If you have any ideas, thoughts or requests how I can make this newsletter as best as possible feel free to share it with me. For your help I will add you to my newsletter for FREE π€
I appreciate your help and let's dive in! π
Subscribe to another newsletter I run!
3330 subscribers already! π
Weekly newsletter featuring the best tools for iOS developers. Subscribe if you like @iOS developers
Sponsored Link
Must See Webinar π: The Future of Mobile App Releases
A live webinar by the AppCircle. Speakers, Pol Piella and Ural Emekci, will talk about:
- What does the future of CI/CD look like?
- What role can AI play?
- What does platform maturity look like for your in a mobile team?
- What does 'peak'Β performance look like in mobile DevOps?
It's FREE to join. Click the link below and reserve your seat now!
Swift Around the Web
Fetching OSLog Messages in Swift
This blog post explains how to retrieve and display OSLog messages within your Swift app. It's helpful for debugging and analyzing the app behavior.
Key points:
- You can use OSLogStore to fetch logs at runtime.
- Filter retrieved logs based on subsystem, category, message type, etc.
- The blog provides code examples for formatting timestamps and messages.
- Display logs within your app using a LogView for convenient debugging and analysis.
In essence, this approach allows you to see logs directly within your app, providing valuable insights during development.
Trigger Value Pattern in SwiftUI
SwiftUI's recent update introduces the trigger value pattern, allowing you to attach view modifiers that react to changes in a specific value. This pattern simplifies building reusable and data-driven functionalities.
With trigger values, you can craft custom view modifiers that become your development playground. These modifiers react dynamically to data changes, simplifying code and boosting reusability.
The benefits are clear: It helps to create a more engaging user experience with dynamic interactions, streamline development by building reusable code, and achieve cleaner and more maintainable SwiftUI projects.
Coding
Remove ObservableObject from Your SwiftUI Model
SwiftUI is becoming more convenient, and it's time to consider switching from ObservableObject to the new @Observable macro.
ObservableObject vs. @Observable:
ObservableObject:
- A foundational tool for reactive programming in SwiftUI.
- Requires using @Published for properties to trigger UI updates.
- Can become cumbersome for complex applications.
@Observable:
- A new macro available in iOS 17 that simplifies data binding.
- Offers cleaner syntax with direct property wrappers (var).
- Provides more granular control over data updates, leading to better performance.
While @Observable lacks built-in projected values (like $model.text), workarounds like @Bindable exist. Overall, @Observable streamlines data binding and state management, making it a valuable tool for developers working with SwiftUI in iOS 17 and above.
Removing the M from MVVM with SwiftUI
This blog post explores an alternative approach to building SwiftUI apps by removing the ViewModel (M) from MVVM.
Key takeaways:
- State-driven views: Views directly manage their state using @State and avoid separate ViewModels.
- Benefits: Simpler code, easier testing, and improved maintainability.
- Example: Building a list of notification requests with different loading, error, and data states.
- Testing: Use snapshot tests to compare rendered views based on different states.
This approach is suitable for developers seeking a simpler way to structure SwiftUI applications, particularly for those comfortable with testing views directly.
Apple News
Apple Developer Videos on YouTube
Apple officially launched its Apple Developer channel on YouTube. This channel offers a convenient way to watch videos previously only available within the Developer app, including content from the annual Worldwide Developers Conference (WWDC).
Subscribing to the Apple Developer channel on YouTube allows you to stay informed about the latest advancements in Apple software, technologies, and platforms. This channel caters to coders, students, and anyone interested in keeping pace with the ever-evolving Apple development landscape.
Other Cool Stuff
Navigating the Retirement of App Center: Embracing Appcircle as the Ultimate Alternative
Visual Studio App Center is shutting down, but fear not. Appcircle is a great alternative for mobile app development.
Mobile app developers using Visual Studio App Center will need to find a new platform as it's shutting down.
Appcircle is a strong alternative offering similar features like build automation, better testing, and app distribution. It adds advantages in customization, real device testing with security, automated unit and UI testing, self-hosting options, and automated app store deployment.
Additionally, Appcircle integrates with leading analytics and diagnostics tools for a more comprehensive development experience. So, ultimately it makes mobile app development easier and faster.
In Case You Missed It
Enums in Swift: Full Guide
This blog post explores enums, a fundamental data type in Swift that offers significant benefits for developers to enhance the code readability and maintainability.
They offer several advantages:
- Clear Data Representation: Enums categorize data types, making code more understandable.
- Reduced Errors: Enums enforce valid data usage, minimizing bugs.
- Type Safety: Enums ensure functions receive and return the correct data types.
Use enums for representing:
- Different data types (fruits, days of the week).
- System states (loading, finished).
- Validation errors (empty name, invalid email).
Tutorials
Camera capture setup in a SwiftUI app
This guide gets you started with displaying a live camera feed within your SwiftUI app. It utilizes AVFoundation to capture video frames and present them on screen.
A key component is the CameraManager
class. It handles camera setup, user authorization, and delivers captured frames as images using an asynchronous stream.
The guide walks you through configuring the capture session, managing the image stream, and creating a SwiftUI view (CameraView) to display the camera feed. It also includes a ViewModel class to connect everything and update the displayed image.
With this foundation, you can integrate camera functionality into your SwiftUI apps. It opens doors for exploring features like saving photos, adjusting video resolution, and even using the Vision framework for content analysis.
Videos
How to Easily Test Push Notifications in the iOS Simulator
Normally, testing push notifications involves a bunch of complicated setup. But this video lets you skip all that. Here's what you need to do:
- Create a simple file with some text about your notification and with the bundle identifier.
- Save that file with a .apns extension.
- Drag and drop the .apns file onto your iPhone simulator and voila! You can see your notification pop up.
If you're more comfortable with commands, the video also shows how to trigger the notification using the Terminal app on your mac.
This is a great way for developers to quickly test their push notifications on a simulator without getting bogged down in complex setup processes.
MapKit with SwiftUI
This video, part 9 of a MapKit series, shows you how to display routes and directions within your SwiftUI app.
Key takeaways:
- Plan Your Route: Learn how to display a route between your current location and a chosen placemark.
- Choose Your Mode: See how to toggle between driving and walking directions.
- Step-by-Step Guidance: Get a breakdown of the route's directions.
This video equips you to create a user-friendly map experience with turn-by-turn navigation features.