🧰 The collection of open-source iOS tools I rely on daily ✌️
Welcome to the issue #25 of the iOS Coffee Break Newsletter 📬.
The iOS community has a very active open-source scene, which provides a lot of useful tools to improve the quality of an app. This week, I am highlighting some open-source utilities that I regularly use in both my professional and personal iOS development projects.
SwiftLint
SwiftLint enforces coding standards and best practices in Swift, promoting clean, maintainable, and readable code. It flags issues like force-unwrapping through warnings and errors, similar to a code review. By automating this process, SwiftLint reduces manual effort during reviews, enabling developers to focus on more critical aspects.
Here is an example of how you can disable rules in code:
If you are not aware, you can install and run SwiftLint globally, allowing you to check the code quality of any file on your Mac.
Fastlane
Fastlane is a versatile automation tool designed for mobile app projects, offering a wide array of actions and plugins.
It allows you to create complex workflows, known as "lanes" to perform tasks such as building, testing or deploying your iOS application.
It integrates seamlessly with various CI services and uses a configuration file called a Fastfile
to define these workflows.
This makes it a powerful solution for streamlining repetitive processes and maintaining efficiency in your app development pipeline.
Here is a sample Fastfile
with a test lane:
SwiftGen
SwiftGen is a tool that generates Swift code to provide type-safe access to project resources like images, localized strings, and more. By automating this process, SwiftGen helps prevent runtime errors caused by incorrect resource usage, ensuring a safer and more efficient development workflow.
Here is an usage example:
Sourcery
Created by Krzysztof, Sourcery is a Swift code generator built on top of SwiftSyntax. It enhances language abstractions, enabling developers to automatically create boilerplate code.
Here is an example of how to use it with a Struct
:
You can use Sourcery Annotations to write the default value for the generated mock.
Here is the code generated by Sourcery:
What would you add to this list? Let me know on Twitter!
Now it is time to dive into some iOS development topics submitted by the community. Here are this week's highlighted resources. Hope you enjoy 🙌.
📬 Deploying an Email System with SwiftCloud
Recently, Natan from Swift Toolkit.dev introduced a feature on his website allowing readers to subscribe to email updates for new posts. This week, he partnered with Andrew to create a hands-on video using SwiftCloud, showcasing a quick recap of his mailing system built entirely in Swif.
If you are considering adding a Swift-based mailing system to your newsletter, this resource is definitely worth exploring!
🤖 Creating ML models with Create ML
Artem recently concluded his series on text analysis with a post detailing how to create a custom machine learning model for sentiment analysis in new languages using Apple's Create ML tool.
Though I hadn’t tried Create ML before, this article highlighted how straightforward it is to use without requiring extensive machine learning expertise. With a strong dataset, it serves as an excellent starting point for building machine learning models for your apps!
❌ Bad practice: not using the modern formatting API
DateFormatter is incredibly handy but can be prone to errors! Mistakes like using an incorrect format or creating too many instances can harm performance.
Since iOS 15, Apple introduced a cleaner, more efficient API for formatting values. In this brief post, Vincent provides an excellent introduction to this modern approach, showing how you can start leveraging it to simplify and optimize your apps.