Background Location Updates in iOS: Addressing Technical Caveats
In this article, I would like to cover live location updates while an iOS application is in the background. How they are different from usual in-app updates, what changes need to be made to the project, and some techniques to make our lives easier. Project Setup Let’s start with the setup steps that are required for an iOS project to be able to get location updates in the background. Project Info (Plist) Project > Info We need to add the privacy explanation strings: Note: Two are required because the process of acquiring consent for ‘Always’ mode is a two-step process;…
Easy Network Mocking in Swift at the URLSession Level
When building apps that rely on external WebServices, developers typically face the challenge of how to test and preview features without relying on a live production environment. Standard approaches usually involve maintaining a dedicated development server or creating complex “faked” service instances. While both are valid, they often introduce significant overhead and architectural boilerplate.An elegant alternative or/and addition is to fake network responses at the URLSession level. This approach moves the mocking logic outside of your specific API clients, keeping your architecture lean and allowing you easily to simulate API behaviors that aren’t even live in production yet. Setup Note:…
Simple Testable SwiftUI Architecture for Small Projects
Introduction In this post, I explore the problem of building an architecture for small-scale projects. My main goal is to build a super simple architecture that is easy to follow and adapt. It should work out of the box for unit testing, UI testing, and previews. Furthermore, in situations with unresolvable limitations, it should be easy to refactor. Architecture Goals Architecture Global Shared Data Providers and Services This is likely the only controversial part of this architecture. I plan to access data providers and services directly from a global shared object. In a standard enterprise environment, this might be considered…
Building Dynamic Data Sources with Swift Combine: The Lazy Publisher Pattern
Note: As a non-native speaker, I’m using AI for grammar and spelling checks, but the source code and the “unpolished” version of this post were generated by my own mushy human brain. It’s a bit sad that a disclaimer like this even needs to exist. Introduction In iOS and macOS development, we frequently deal with resource-intensive data sources. It’s best to observe them only when necessary, but managing their lifecycle and state is often a challenge. Additionally, they are notoriously difficult to mock for tests and UI previews. This post explores a Lazy/Dynamic Publisher pattern and provides a reusable base…
Fixing the “Private” Problem: Public Localization in Swift Packages
Introduction In this post, I want to discuss the nuances and common problems of string localization within Swift Packages. And hopefully provide a practical reasonable workflow for using these strings effectively. How to Use Localized Strings in Packages Note: This post focuses exclusively on LocalizedStringResource and scenarios where strings are manually created within a String Catalog. My experiments with Playground projects revealed that “inline” localized strings (declared directly in code) often fail to extract automatically into catalogs unless they are used directly within a Text component (which defeats the purpose of maintaining reusable public strings). Imagine we have a package…
iOS Offline On-Device Live OCR and Translation with ML Kit, Apple Vision and Tesseract
In this article, I’ll explore the technical implementation behind an iOS demo application designed to showcase offline live OCR with real-time translation, and barcode scanning capabilities. The full source code is available in the GitHub repository: https://github.com/AndreiMaksimovich/ios-live-offline-ocr-and-translation–demo Technology Stack Application is written using Swift programming language and SwiftUI as GUI framework. OCR The application integrates multiple libraries to provide live, offline OCR functionality: MLKit The Google MLKit Text Recognition v2 API (on-device/offline) supports text recognition in Chinese, Devanagari, Japanese, Korean, and Latin-based character sets. Learn more: Apple Vision The Apple Vision Framework supports on-device text recognition in 18 languages,…
Android Offline Live OCR & Translation with ML Kit and Tesseract
Repository: https://github.com/AndreiMaksimovich/android-live-ocr-and-translation–demo In this article, I’ll walk through some technical details of the creation of an android technical demo project that showcases offline live OCR and translation. The project uses Google ML Kit Text Recognition V2 for OCR and Tesseract as a fallback (when language in not supported by ML Kit), and relies on Google ML Kit Translation for on-device translations. Technology Stack The application is built using Kotlin and XML layouts. The application integrates several open-source and Google-provided components: OCR Implementation In this demo, OCR is implemented through an abstraction layer with a factory that provides an OCR service.…
Cross-Platform Maps in React Native: Android, iOS, and Web
All source code and example project is available here: https://github.com/AndreiMaksimovich/react-native-maps-web–demo Android iOS Web Give it a try: The Problem Maps are one of the most common features found in modern applications. In React Native, the default choice for maps is react-native-maps. While it works well on iOS and Android, it doesn’t provide support for the web. In fact, none of the popular, well-established map libraries currently offer proper web build support. Notice: There is a library called teovillanueva/react-native-web-maps, but it hasn’t been well maintained recently and still offers only very limited functionality. The Goal Our objective was to build a…
Optimizing Unity WebGL: Separate Builds for Mobile Web and Desktop Web
Why Use Double Builds for Your Unity 3D Game Texture Compatibility One of the key reasons is asset compatibility. In particular, texture support differs significantly between Mobile Web (Android & iOS devices) and Desktop Web (macOS, Linux, Windows). To better understand why this matters, let’s take a closer look at the data: Desktop Browsers iOS and Android browser RGB Compressed ETC2 No Yes RGB Crunched ETC No Yes RGBA Compressed ETC2 No Yes RGBA Crunched ETC2 No Yes RGB Compressed DXT1, also known as BC1 Partial (*) No RGB Crunched DXT1, also known as BC1 Partial (*) No RGBA…
Automating Local React Native Expo EAS Builds for Android, iOS and Web
In this article I want to share a simple example setup for automating local React Native Expo builds with EAS for Android, iOS, and Web. The workflow demonstrates how to: automatically generate platform specific builds, install generated .apk file on all connected Android devices, deploy .ipa file to all connected iOS devices, and spin up a Docker container to serve the web build. The core idea of this setup is to provide simple automation for preview test builds. However, it can be easily adapted or extended to support production builds, automated distribution, and additional workflows. All scripts, configurations and docker…