100% Offline Maps in an iOS Application Using Free and Open-Source Tools
In this post, I’d like to show a simple, free, and open-source solution for using 100% offline vector maps in an iOS application. The complete source code for my playground is available on GitHub , so I won’t cover the implementation details here. Instead, this post focuses on the overall technology stack, explains how the components fit together, and provides links to all of the tools and resources you’ll need. Technology Stack iOS Map Library Vector Tile Schemas Map Styles Download OpenStreetMap Data Generate MBTiles from .osm.pbf How Everything Fits Together To avoid confusion, here’s how the individual pieces work…
Testing Apple Intelligence for Structured Data Extraction
In this post, I would like to cover my experiments with Apple Intelligence – the on-device, built-in language model – specifically focusing on extracting data (in this case, dates) from user voice input: Voice → Speech-to-Text → LM → App API → App GUI. Before I start, I would like to make my position on LLMs clear. I do not see much sense or value in generative AI overall, except when it comes to working with language (f.e. proofreading) and generating code snippets. However, I do see a future for LLMs as local models used as a communication interface/level between…
How to Test SwiftData Schema Updates and Data Migrations
In this article, I would like to cover technical specifics related to SwiftData schema updates and the unit testing of data migration. Understanding iOS Application Updates Let’s start with some specifics regarding iOS application updates: Goals for Project Structure and Testing Solution Required Procedures To achieve these goals, we should: Implementation The complete source code for this project is available on GitHub:: Example Project Schemas: Migration plans: Types: Note: You cannot migrate back to the same schema even if it is redefined with a new schema version. SwiftData calculates the schema fingerprint based on models and their fields; it…
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.…