HomeCase studiesA Native Kotlin and Swift Grocery Basket...

Case study · Cork, Ireland

A Native Kotlin and Swift Grocery Basket Price Comparison and Ordering Platform

Retail grocery and consumer price comparison

Comparing supermarket prices one item at a time rarely reveals where a weekly household shop is actually cheapest once pack sizes, promotional tiers, and delivery fees are factored in. We engineered native Android and iOS mobile applications in Kotlin and Swift, using Retrofit and URLSession networking layers connected to a normalized retail pricing backend. Shoppers build or scan full multi-item baskets, compare single-store versus split-basket totals accurately on a per-unit basis, and transition cleanly into retailer ordering without stalled feeds or stale promotion data.

Industry
Retail grocery and consumer price comparison
Solution
Native Android (Kotlin) and iOS (Swift) consumer mobile applications backed by a canonical grocery SKU normalization, unit-pricing, and basket comparison engine.
Platforms
Android · iOS
Stack
Kotlin · Swift · Retrofit · Jetpack Compose · SwiftUI · Room
Location
Cork, Ireland · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Cork, Ireland. Names withheld by agreement.

Project Overview

Supermarket pricing looks straightforward only until a shopper tries to compare an entire weekly trolley across competing chains. One retailer sells pasta in 500-gram bags while another stocks 450-gram packs; promotional discounts apply only with a loyalty card or in multiples of two; and split-shop savings vanish quickly once delivery fees are included.

We built native Android and iOS grocery comparison and ordering applications in Kotlin and Swift, connecting shoppers to a canonical retail catalog and basket-optimization backend. Users compile recurring shopping lists, scan kitchen barcodes for instant replacement lookups, inspect side-by-side single-store and split-basket totals adjusted for delivery thresholds, and hand off filled carts directly into retailer ordering flows.

Business Bottleneck

Consumer price-comparison prototypes routinely fail on three practical fronts:

  • Apples-to-oranges catalog mismatch: Raw supermarket feeds describe identical staples with inconsistent abbreviations, pack weights, and multi-pack groupings, causing naive string matching to miss valid comparisons or pair unrelated goods.
  • Misleading single-item rankings: Highlighting the cheapest brand of coffee means little if every other staple in a user's trolley costs more at that chain or fails to clear minimum delivery spend.
  • Sluggish indoor retail UX: Thick metal-roofed supermarkets degrade mobile reception right when shoppers pull out their phones in the aisles, freezing webview-based lists mid-shop.

Architectural Strategy

We invested in dedicated native clients—Kotlin with Jetpack Compose and Retrofit on Android, and Swift with SwiftUI and URLSession on iOS—so barcode scanning, haptic list sorting, and offline persistence behave cleanly inside real store environments. Both apps treat local relational storage (Room and Core Data) as primary for shopping lists while fetching live pricing deltas asynchronously.

On the backend, product ingestion pipelines normalize retailer feeds into canonical product groups indexed in PostgreSQL. Instead of pushing heavy comparison math onto handsets across thousands of SKUs, the server evaluates multi-store basket permutations, loyalty eligibility, and delivery fee tiers in one structured response consumed identically by Retrofit and URLSession models.

Core Capabilities

  • Barcode Pantry Scanning: Shoppers point the phone camera at empty boxes or jars to locate exact matches and equivalent store-brand alternatives across supermarkets immediately.
  • Unit-Normalized Basket Matrix: Side-by-side store breakdowns show item availability, pack-size differences, per-kilogram or per-litre rates, and missing-item substitution suggestions.
  • Promotion & Loyalty Modeling: Users toggle their active supermarket loyalty memberships and see multi-buy bundle thresholds calculated dynamically as quantities change.
  • Single-Store vs. Split-Cart Toggle: The comparison view contrasts the convenience of ordering from one supermarket against splitting high-value staples across two chains once delivery fees apply.
  • Retailer Ordering Handoff: Confirmed baskets export cleanly through retailer cart deep links or integrated checkout flows while preserving in-app list history for next week's shop.

Technical Architecture

Android structures presentation through Jetpack Compose screens observing Kotlin StateFlow view models backed by a Room repository and Retrofit service interfaces. OkHttp interceptors inject app-version headers, manage ETag conditional caching, and coalesce duplicate in-flight searches while typing. iOS mirrors this clean separation in Swift using SwiftUI views, async/await repositories, Core Data list persistence, and URLSession HTTP caching.

Flow: CameraX/AVFoundation barcode scan or Compose/SwiftUI search -> Local Room/Core Data list update -> Conditional Retrofit/URLSession basket quote request -> PostgreSQL canonical SKU & promo evaluation -> Native UI renders store-ranked matrix -> Deep-link or checkout handoff to selected retailer.

Both native clients maintain local lookup caches for recently viewed staples and store metadata, keeping aisle checklists instantaneous even when cellular bars disappear inside store refrigeration aisles.

Technology Stack

Category Technology detail
Android language & UI Kotlin with Jetpack Compose, Coroutines, and StateFlow
Android networking Retrofit paired with OkHttp interceptors, ETag caching, and Kotlinx Serialization
Android local storage Room SQLite database for offline shopping lists and recent barcode lookups
iOS language & UI Swift with SwiftUI, async/await structured concurrency, and Combine
iOS networking URLSession client with Codable models and HTTP cache-control handling
iOS local storage Core Data / SQLite store mirroring persistent baskets and price alerts
Barcode capture Native CameraX ML barcode scanning (Android) and AVFoundation (iOS)
Catalog & pricing store PostgreSQL full-text search with canonical SKU and unit-price normalization
Telemetry Native crash reporting and per-endpoint network latency instrumentation

Engineering Trade-offs & Solutions

Architectural Dilemma Chosen Solution & Rationale
Cross-platform UI wrapper vs. native Kotlin & Swift Chose native Compose and SwiftUI to exploit hardware-accelerated CameraX/AVFoundation barcode pipelines and crisp offline list interactions where shoppers expect instant feedback.
On-device full catalog sync vs. basket-scoped delta quotes Kept raw retailer feeds on the server and queried normalized comparison quotes per active basket, avoiding multi-megabyte mobile database downloads while staying accurate as daily promos turn over.
Strict exact-EAN matching vs. canonical product grouping Layered canonical product families over EAN barcode links so own-label equivalents and slight pack-weight variations compare transparently alongside exact brand matches.
Raw Retrofit/URLSession calls vs. ETag-aware repository caching Configured HTTP conditional caching in OkHttp and URLSession so unchanged aisle categories resolve locally without burning mobile bandwidth.

Security & Reliability

Retailer pricing feeds arrive on staggered schedules and occasionally contain malformed promotional tags or discontinued EANs. Ingestion validators quarantine anomalous price swings—such as missing decimal points—for analyst review before publishing updates to mobile clients, protecting shoppers from phantom bargains.

User accounts store saved lists, postcode delivery zones, and loyalty preferences using scoped bearer tokens held in encrypted device keystores. When transferring baskets to external retail ordering portals, outbound deep links carry only SKU identifiers and quantities without leaking personal mobile analytics or cross-store list history to third-party merchants.

Performance & Scale

Typing into grocery search bars generates bursty query patterns. Both Kotlin Coroutines (debounce + flatMapLatest) and Swift async task cancellation abort superseded keystroke queries cleanly before Retrofit or URLSession hits the backend, preserving server CPU and mobile battery.

On the database tier, PostgreSQL GIN full-text indexes combined with pre-computed unit-price columns allow multi-store basket comparisons to resolve smoothly without expensive runtime parsing. Image thumbnails load progressively with disk-backed caches, ensuring brisk scroll performance across long weekly shopping histories.

Operational Outcomes

Delivering dedicated Kotlin and Swift applications backed by a unified normalization engine turned fragmented supermarket price checks into a coherent weekly planning tool. Shoppers gain honest, unit-adjusted visibility into how multi-buy deals and delivery fees affect their total bill, while the offline-capable Room and Core Data list architecture keeps the app dependable both at the kitchen table and inside low-signal supermarket aisles.

01 — Questions

asked about this kind of project

Why build separate native Android (Kotlin/Retrofit) and iOS (Swift) apps instead of a hybrid wrapper?

Grocery browsing involves rapidly scrolling dense product grids, instant camera barcode scanning in dim kitchen pantries, and smooth drag-or-swipe list editing. Native Jetpack Compose and SwiftUI paired with CameraX and AVFoundation deliver low-latency scanner autofocus and responsive list state without bridge overhead.

How does the system compare identical products sold in slightly different pack sizes across supermarkets?

Every ingested retailer SKU is mapped during catalog normalization to canonical product families with standardized base units—such as price per kilogram, litre, or count. When comparing baskets, the comparison engine aligns equivalent pack sizes or surfaces unit-normalized substitutions transparently.

How do Retrofit on Android and URLSession on iOS avoid overwhelming mobile data plans with frequent price refreshes?

Both mobile clients leverage conditional HTTP requests using ETag and Cache-Control headers alongside compact serialized payloads. Active baskets request differential price-and-promo checks only for items in the user's current list rather than re-downloading entire category trees.

How are multi-buy promotions and loyalty-card prices reflected in basket totals?

The pricing engine separates base shelf price, multi-buy threshold rules (such as two-for-one bundles), and loyalty-tier pricing into structured promotion modifiers. Shoppers toggle which store loyalty programmes they hold so basket totals reflect real checkout costs rather than generic sticker prices.

What happens when a shopper edits their grocery list inside a supermarket with poor indoor reception?

Lists persist locally inside Room on Android and Core Data on iOS as the primary source of truth. Shoppers check off items, scan barcodes for queue lookup, and tweak quantities offline; once reception returns, the apps reconcile basket state against current store prices seamlessly.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.