The Testo iOS app is a hybrid food‑ordering application built with SwiftUI and a custom WKWebView wrapper. It brings the full functionality of the existing Testo website to iOS, while adding native behavior for links, payments and sharing.
The core UI is a SwiftUI view (TestoWebView) that conforms to UIViewRepresentable and embeds a WKWebView configured with:
WKWebViewConfigurationandWKPreferencesto allow JavaScript and window opening.WKWebsiteDataStore.nonPersistent()when needed, so no persistent cache is stored.URLRequestwithreloadIgnoringLocalCacheDatato force fresh content for payment and critical flows.
A Coordinator class implements WKNavigationDelegate and WKUIDelegate and manages:
- Loading state – updates a
@Binding isLoadingto show/hide a loading indicator in SwiftUI. - Payment URLs – intercepts Alfa‑Bank URLs (
private.auth.alfabank) and reloads them explicitly with no cache inside the same web view. - Custom app schemes – supports a whitelist of non‑http(s) schemes (e.g. banking/finance apps).
- If the app is installed (
UIApplication.shared.canOpenURL), it opens the native app. - If not, it checks for a
paymentPagequery parameter, decodes it and reloads the fallback payment page inside the web view.
- If the app is installed (
- System schemes – handles
tel:,mailto:, andsms:by opening the Phone, Mail or Messages apps when available, and cancels the web navigation. - Telegram sharing – for
tg://msg?text=...links:- extracts and decodes the shared text,
- tries to open Telegram with prefilled text,
- otherwise falls back to
https://t.me/share/url?text=....
- WhatsApp sharing – for
https://api.whatsapp.com/send?text=...andhttps://wa.me/...:- extracts the
textparameter (including fromwa.mequery), - encodes and opens
whatsapp://send?text=...if WhatsApp is installed, - or falls back to the web URL.
- extracts the
To avoid issues with pop‑up windows and duplicate loads:
- When
navigationAction.targetFrame == nil, the coordinator treats it as “open in new window”, - Manually loads the target URL in the main web view with no‑cache
URLRequest, - Uses
lastManuallyLoadedURLand timestamps to prevent the same URL from being loaded twice in quick succession.
A reloadInitial() helper lets the hosting layer easily reload the original URL, again with cache disabled if required.
Overall, the Testo iOS app delivers a user‑friendly food ordering experience on top of the existing website, while the technical implementation focuses on safe payment flows, correct deep‑link handling, and smooth integration with native iOS apps and share targets.
Tech stack: Swift, SwiftUI, WKWebView (UIViewRepresentable), Custom URL handling (Alfa‑Bank payments, custom schemes, Telegram, WhatsApp, tel:, mailto:, sms:)













