YaniPay pour iOS
L'application native flagship de YaniPay pour iPhone. Construite entierement en SwiftUI avec une architecture progressive a 4 couches, 132 fichiers Swift et 19 managers specialises.
iOS 18.5+ • SwiftUI • Core Data • CryptoKit • PassKit • CoreML
Overview
YaniPay iOS est l'application phare de la plateforme, concue pour offrir une experience financiere native complete sur iPhone. Elle tire parti des technologies exclusives d'Apple — Apple Pay, Face ID, WidgetKit, Siri, App Clips — pour proposer des paiements instantanes, une gestion financiere intelligente et un assistant IA embarque.
L'architecture repose sur un systeme de chargement progressif a 4 couches qui garantit un demarrage rapide tout en initialisant les 19 managers de facon asynchrone. Le code source comprend 132 fichiers Swift organises en modules clairs suivant les conventions SwiftUI et les guidelines Apple HIG.
Minimum iOS 18.5+
YaniPay iOS cible iOS 18.5 et superieur pour exploiter les dernieres APIs Apple Intelligence, WidgetKit interactifs, et les ameliorations de performance SwiftUI. Les appareils compatibles incluent iPhone XS et ulterieur (A12 Bionic minimum).
Key Features
L'application integre 8 fonctionnalites majeures qui exploitent les capacites materielles et logicielles specifiques a l'ecosysteme iOS.
Apple Pay
Token-based secure payments via PassKit. Supports recurring payments, installment plans, and in-app purchases with zero card data exposure.
Tap-to-Pay NFC
Accept contactless payments directly on iPhone without any external card reader. ProximityReader framework with TapToPayManager.
Y.A.N.I. AI Assistant
15 ML-classified intents processed on-device via YANIUnifiedManager. Natural language commands for transfers, balance checks, and analytics.
Biometric Auth
Face ID and Touch ID authentication backed by Secure Enclave key storage. Automatic fallback chain with device passcode.
WidgetKit
Lock Screen, Home Screen, and StandBy widgets with Live Activities for real-time transaction tracking and balance display.
App Clips
Standalone lightweight payment experience without full app installation. Triggered via NFC tags, QR codes, or App Clip codes.
Siri Shortcuts
Voice-activated commands with intent donation for proactive suggestions. "Hey Siri, send 50 euros to Marie" powered by SiriKit.
Apple Intelligence
Proactive notifications, smart suggestions, and on-device ML predictions. Leverages iOS 18+ foundation models for contextual insights.
App Architecture
YaniPay iOS utilise une architecture de chargement progressif a 4 couches. Ce pattern garantit que l'utilisateur voit un ecran immediatement (splash screen) pendant que les managers lourds s'initialisent en arriere-plan. Chaque couche se resout avant de passer a la suivante.
YANIPEL brand animation with Lottie
Async manager initialization (19 managers)
Onboarding flow or biometric login (Face ID / Touch ID)
SimpleContentView → LazyContentView → ContentView (progressive complexity)
// 4-Layer Progressive Loading Architecture
// 1. SplashScreenView (2s) - YANIPEL brand animation
// 2. LoadingView - Async manager initialization
// 3. AuthenticationManager - Onboarding or Login
// 4. Main App - SimpleContentView -> LazyContentView -> ContentView
@main
struct YanIPayApp: App {
@State private var yaniUnifiedManager: YANIUnifiedManager?
@State private var authManager: AuthenticationManager?
@StateObject private var applePayManager = ApplePayManager()
@StateObject private var biometricManager = BiometricAuthManager()
@StateObject private var syncManager = SyncManager()
@StateObject private var notificationManager = NotificationManager()
var body: some Scene {
WindowGroup {
SplashScreenView()
.task {
await initializeManagers()
}
.environmentObject(applePayManager)
.environmentObject(biometricManager)
.environmentObject(syncManager)
}
}
private func initializeManagers() async {
// Phase 1: Critical managers (security + auth)
let security = SecurityManager()
let encryption = EncryptionManager()
let biometric = BiometricAuthManager()
// Phase 2: AI + Analytics (parallel)
async let yani = YANIUnifiedManager.initialize()
async let prediction = PredictiveAnalyticsEngine.initialize()
async let recommendations = AIRecommendationEngine.initialize()
// Phase 3: Hardware optimizations
let haptics = PremiumHapticsManager()
let animations = AnimationManager()
// Await all parallel tasks
self.yaniUnifiedManager = await yani
_ = await (prediction, recommendations)
}
}Progressive Loading
Le pattern SimpleContentView → LazyContentView → ContentView permet d'afficher une interface fonctionnelle en moins de 2 secondes, puis de charger progressivement les fonctionnalites avancees (charts, AI, analytics) en arriere-plan.
Navigation Structure
L'application utilise une TabView a 5 onglets comme navigation principale, suivant les conventions iOS avec une barre de tabs en bas de l'ecran. Chaque onglet contient sa propre pile de navigation (NavigationStack).
Dashboard
Portfolio charts, KYC verification status, quick actions, and real-time balance overview with trend indicators.
Payments
Apple Pay integration, P2P transfers, QR code payments, recurring payments, and full transaction history.
Clients
Merchant client management, contact directory, payment requests, and invoicing tools for professionals.
Analytics
ML-powered spending predictions, category breakdowns, budget tracking, and exportable financial reports.
More
App settings, Y.A.N.I. AI assistant, loyalty program, security preferences, and notification configuration.
struct ContentView: View {
@State private var selectedTab: Tab = .dashboard
@EnvironmentObject var applePayManager: ApplePayManager
@EnvironmentObject var biometricManager: BiometricAuthManager
enum Tab: String, CaseIterable {
case dashboard = "Dashboard"
case payments = "Payments"
case clients = "Clients"
case analytics = "Analytics"
case more = "More"
var icon: String {
switch self {
case .dashboard: return "chart.bar.fill"
case .payments: return "creditcard.fill"
case .clients: return "person.2.fill"
case .analytics: return "chart.line.uptrend.xyaxis"
case .more: return "ellipsis.circle.fill"
}
}
}
var body: some View {
TabView(selection: $selectedTab) {
ForEach(Tab.allCases, id: \.self) { tab in
NavigationStack {
tabContent(for: tab)
}
.tabItem {
Label(tab.rawValue, systemImage: tab.icon)
}
.tag(tab)
}
}
}
}Managers (19)
L'application est structuree autour de 19 managers specialises, chacun responsable d'un domaine fonctionnel precis. Cette architecture modulaire facilite les tests unitaires, le remplacement de composants et la maintenance independante de chaque fonctionnalite.
Payment
4ApplePayManagerCore Apple Pay integration with PKPaymentAuthorizationController, payment sheet configuration, and token handling.
EnhancedApplePayManagerExtended Apple Pay with recurring payments, installment plans, coupon support, and multi-merchant splitting.
TapToPayManagerProximityReader framework integration for accepting contactless NFC payments directly on iPhone.
AppleWalletManagerPassKit passes management, card provisioning to Apple Wallet, and digital pass lifecycle.
Intelligence
6YANIUnifiedManagerCentral AI orchestrator. Manages 15 NLU intents, dialogue state, and response generation with CoreML models.
AIRecommendationEnginePersonalized spending recommendations, savings suggestions, and merchant discovery based on transaction patterns.
PredictiveAnalyticsEngineML-powered financial forecasting, anomaly detection, budget predictions, and cashflow modeling.
AppleIntelligenceManageriOS 18+ Apple Intelligence integration for proactive notifications, smart summaries, and contextual suggestions.
AdvancedVoiceRecognitionOn-device speech recognition with Speech framework, multilingual support (FR/EN), and voice biometric verification.
SiriShortcutsManagerSiriKit intent registration, shortcut donation for proactive suggestions, and voice command routing.
Hardware
3iPhone15ProOptimizerHardware-specific optimizations for A17 Pro chip: ProMotion 120Hz, 48MP camera for document scanning, USB-C.
AnimationManagerSwiftUI animation orchestration, Core Animation metal-backed transitions, and micro-interaction library.
PremiumHapticsManagerCore Haptics engine with custom patterns for payment confirmations, errors, and navigation feedback.
Security
4BiometricAuthManagerFace ID / Touch ID authentication with LAContext, automatic fallback, and Secure Enclave key management.
SecurityManagerJailbreak detection, SSL pinning, runtime integrity checks, and anti-tampering measures.
EncryptionManagerCryptoKit AES-256-GCM encryption, HKDF key derivation, and secure data-at-rest with Keychain Services.
EnhancedSecurityManagerAdvanced threat detection, session management, device binding, and anomalous behavior flagging.
Sync & Notifications
2SyncManagerCore Data + CloudKit synchronization, conflict resolution, offline-first queue, and background refresh.
NotificationManagerAPNs registration, rich push notifications, notification categories, and Live Activity updates.
Thread Safety
Tous les managers utilisent @MainActor pour les operations UI et Swift Concurrency(async/await) pour les operations d'arriere-plan. Les managers de securite (SecurityManager, EncryptionManager) operent exclusivement dans le Secure Enclave via des appels synchrones Keychain.
Project Structure
L'arborescence du projet iOS suit les conventions Xcode avec une separation claire entre les vues, les managers, les models et les ressources.
YaniPay/
├── YanIPayApp.swift # App entry point (4-layer loading)
├── ContentView.swift # Main TabView (5 tabs)
├── SimpleContentView.swift # Lightweight initial view
├── LazyContentView.swift # Progressive feature loading
│
├── Views/
│ ├── Dashboard/
│ │ ├── DashboardView.swift # Portfolio & KYC status
│ │ ├── BalanceCardView.swift # Real-time balance
│ │ └── QuickActionsView.swift # Send, Request, Scan
│ ├── Payments/
│ │ ├── PaymentView.swift # Apple Pay sheet
│ │ ├── TransactionListView.swift # History with filters
│ │ └── QRCodeScannerView.swift # Camera-based QR
│ ├── Clients/
│ │ ├── ClientListView.swift # Contact directory
│ │ └── InvoiceView.swift # Payment requests
│ ├── Analytics/
│ │ ├── AnalyticsView.swift # Charts & predictions
│ │ └── BudgetView.swift # Budget tracking
│ ├── More/
│ │ ├── SettingsView.swift # App preferences
│ │ ├── YANIAssistantView.swift # AI chat interface
│ │ └── LoyaltyView.swift # Rewards program
│ ├── Auth/
│ │ ├── OnboardingView.swift # First-run flow
│ │ ├── LoginView.swift # Biometric + PIN
│ │ └── KYCView.swift # Identity verification
│ └── Shared/
│ ├── SplashScreenView.swift # Brand animation
│ └── LoadingView.swift # Manager init progress
│
├── Managers/ # 19 specialized managers
│ ├── Payment/
│ ├── Intelligence/
│ ├── Hardware/
│ ├── Security/
│ └── Sync/
│
├── Models/
│ ├── Transaction.swift
│ ├── User.swift
│ ├── Wallet.swift
│ └── YANICoin.swift
│
├── Services/
│ ├── APIService.swift # Network layer
│ ├── KeychainService.swift # Secure storage
│ └── CoreDataStack.swift # Persistence
│
├── Extensions/
│ ├── View+Extensions.swift
│ ├── Color+YaniPay.swift # Brand colors
│ └── Date+Formatting.swift
│
├── Resources/
│ ├── Assets.xcassets # Images & colors
│ ├── Localizable.strings # FR/EN strings
│ └── Animations/ # Lottie files
│
├── Widgets/
│ ├── BalanceWidget.swift # Home Screen widget
│ ├── LockScreenWidget.swift # Lock Screen widget
│ └── LiveActivityView.swift # Live Activities
│
├── AppClips/
│ └── AppClipPaymentView.swift # Standalone payment
│
└── Tests/
├── ManagerTests/
├── ViewTests/
└── IntegrationTests/Build & Deploy
Le processus de build utilise Xcode avec des schemes configures pour le developpement, le staging et la production. Les tests automatises s'executent via xcodebuild et le deploiement passe par App Store Connect avec TestFlight pour les beta testers.
# Development build
xcodebuild -scheme YaniPay-Debug \
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
-configuration Debug \
build
# Run unit tests
xcodebuild test \
-scheme YaniPay \
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
-resultBundlePath TestResults.xcresult
# Archive for distribution
xcodebuild archive \
-scheme YaniPay-Release \
-archivePath build/YaniPay.xcarchive \
-configuration Release \
CODE_SIGN_IDENTITY="Apple Distribution" \
PROVISIONING_PROFILE_SPECIFIER="YaniPay AppStore"
# Export IPA
xcodebuild -exportArchive \
-archivePath build/YaniPay.xcarchive \
-exportPath build/Export \
-exportOptionsPlist ExportOptions.plist
# Upload to App Store Connect
xcrun altool --upload-app \
-f build/Export/YaniPay.ipa \
-t ios \
--apiKey YOUR_API_KEY \
--apiIssuer YOUR_ISSUER_ID
# TestFlight distribution (via App Store Connect API)
xcrun notarytool submit build/Export/YaniPay.ipa \
--team-id YOUR_TEAM_ID \
--wait# Lint Swift code
swiftlint lint --strict --reporter json
# Auto-fix lint issues
swiftlint lint --fix
# Format with swift-format
swift-format format --in-place --recursive Sources/
# Run SwiftUI Previews check
xcodebuild build \
-scheme YaniPay \
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
ENABLE_PREVIEWS=YESCI/CD Pipeline
Le projet utilise Xcode Cloud pour la CI/CD avec des workflows automatises : build sur chaque push, tests sur les pull requests, deploiement TestFlight sur merge vers develop, et soumission App Store sur tag de release.
Requirements
Runtime
- iOS 18.5+
- iPhone XS ou ulterieur (A12 Bionic+)
- iPhone 15 Pro recommande (A17 Pro optimizations)
- 200 MB minimum stockage
Development
- Xcode 16.0+
- Swift 6.0+
- macOS Sequoia 15+
- Apple Developer Account (Team ID required)
Dependencies
- YaniPayCore (Swift Package - internal)
- Lottie (animations)
- SwiftLint (code quality)
- No third-party UI frameworks
Testing
- XCTest (unit & integration)
- XCUITest (UI automation)
- Swift Testing (modern assertions)
- Target: 70%+ code coverage
SwiftUI Views
YaniPay iOS exploite les patterns SwiftUI modernes avec @StateObject, .task pour le chargement asynchrone, et NavigationStackpour la navigation declarative. Le Dashboard View illustre l'architecture typique d'un ecran metier dans l'application.
// Dashboard View with async data loading
struct DashboardView: View {
@StateObject private var walletManager = WalletManager()
@State private var balance: Double = 0
var body: some View {
NavigationStack {
ScrollView {
BalanceCard(amount: balance, currency: .yani)
QuickActionsGrid()
RecentTransactionsList()
}
.task { balance = await walletManager.fetchBalance() }
}
}
}Pattern .task vs .onAppear
Preferez .task a .onAppear pour le chargement de donnees async : .taskannule automatiquement la tache Swift Concurrency quand la vue disparait, evitant les fuites memoire et les mises a jour d'etat sur des vues deja detruites.
Chaque vue suit le principe de separation des responsabilites : les @StateObjectmanagers gerent l'etat metier, les sous-vues (BalanceCard, QuickActionsGrid, RecentTransactionsList) sont des composants purs et reutilisables, et les @Statelocaux gèrent uniquement l'etat UI transitoire.
Deep Linking
YaniPay iOS supporte deux mecanismes de navigation profonde : URL Scheme pour les liens intra-app et les raccourcis, et Universal Linkspour les liens web qui s'ouvrent directement dans l'application quand elle est installee.
// URL Scheme: yanipay://
// Universal Links: https://yanipay.com/app/*
// Supported routes:
// yanipay://payment/{id}
// yanipay://wallet
// yanipay://kyc/status
// yanipay://defi/staking
// Handle incoming deep links in the app entry point
@main
struct YanIPayApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL { url in
DeepLinkRouter.shared.handle(url)
}
}
}
}
// Router implementation
final class DeepLinkRouter {
static let shared = DeepLinkRouter()
func handle(_ url: URL) {
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else { return }
switch components.path {
case _ where url.absoluteString.contains("payment"):
let paymentId = components.path.components(separatedBy: "/").last ?? ""
navigate(to: .payment(id: paymentId))
case "/wallet":
navigate(to: .wallet)
case "/kyc/status":
navigate(to: .kycStatus)
case "/defi/staking":
navigate(to: .defiStaking)
default:
navigate(to: .dashboard)
}
}
}Universal Links — apple-app-site-association
Le fichier apple-app-site-association doit etre accessible a https://yanipay.com/.well-known/apple-app-site-association sans redirection. Il declare les paths autorises a ouvrir l'application (ex: /app/*) et le Team ID + Bundle ID associes.
Apple Wallet Integration
YaniPay genere des passes .pkpass cote serveur via la librairie passkit-generator(Node.js), signes avec un certificat Apple Developer. Le flux complet de l'utilisateur jusqu'au Wallet est entierement natif.
.pkpass Generation Flow
User taps "Add to Wallet"
WalletPassButton — CoreHaptics feedback (UIImpactFeedbackGenerator)
POST /api/wallet-passes/generate
Authenticated request with loyalty card ID + tier
passkit-generator signs .pkpass
Apple Developer certificate (WWDR CA) + private key → binary buffer
iOS receives binary buffer
Content-Type: application/vnd.apple.pkpass
Wallet.app opens automatically
Card displayed with QR code, points balance, tier badge
// WalletPassButton — Add to Apple Wallet with haptic feedback
struct WalletPassButton: View {
let cardId: String
@State private var isLoading = false
@State private var showError = false
private let haptics = UIImpactFeedbackGenerator(style: .medium)
var body: some View {
Button(action: addToWallet) {
HStack(spacing: 8) {
if isLoading {
ProgressView().tint(.white)
} else {
Image(systemName: "wallet.pass")
}
Text(isLoading ? "Generating..." : "Add to Wallet")
.fontWeight(.semibold)
}
.frame(maxWidth: .infinity)
.padding(.vertical, 14)
.background(Color.black)
.foregroundStyle(.white)
.clipShape(RoundedRectangle(cornerRadius: 12))
}
.disabled(isLoading)
.alert("Wallet Error", isPresented: $showError) {
Button("OK") {}
}
}
private func addToWallet() {
haptics.impactOccurred()
isLoading = true
Task {
do {
let passData = try await WalletPassService.shared.generatePass(cardId: cardId)
let pass = try PKPass(data: passData)
let vc = PKAddPassesViewController(pass: pass)
UIApplication.shared.topViewController?.present(vc, animated: true)
// Success haptic
UINotificationFeedbackGenerator().notificationOccurred(.success)
} catch {
showError = true
UINotificationFeedbackGenerator().notificationOccurred(.error)
}
isLoading = false
}
}
}PassKit Integration Complete
Le backend YaniPay genere des passes complets avec QR code, solde de points, niveau de fidelite et couleur de fond dynamique selon le tier (Bronze / Silver / Gold / Platinum). Les passes se mettent a jour automatiquement via les push notifications PassKit (webServiceURL + authenticationToken).
Performance & Battery
YaniPay iOS est optimise pour atteindre 60 fps en animations, un cold start inferieur a 2 secondes et une consommation batterie minimale grace a plusieurs strategies complementaires.
60 fps Animations
- Metal-backed Core Animation layers
- ProMotion 120 Hz sur iPhone 15 Pro (A17 Pro)
- Eviter les
bodySwiftUI trop complexes drawingGroup()pour les vues SVG / Canvas
Cold Start < 2s
- SplashScreenView leger (Lottie JSON preloaded)
- Managers initialises en parallele (async let)
- Core Data stack precree en background
- Aucun reseau bloquant au lancement
Image Caching
NSCacheavec limite 50 MB pour les images distantes- Compression automatique pour les grandes images KYC
AsyncImageavec placeholder skeleton- Cache disque via URLCache (200 MB)
Background & Battery
- Background App Refresh pour le solde (BGAppRefreshTask)
- Detection Low Power Mode via
ProcessInfo.processInfo.isLowPowerModeEnabled - Desactivation des animations ML en Low Power Mode
- Batch network requests avec URLSession
// Low Power Mode detection — disable heavy animations
class PerformanceManager: ObservableObject {
@Published var isLowPowerMode: Bool = false
init() {
isLowPowerMode = ProcessInfo.processInfo.isLowPowerModeEnabled
NotificationCenter.default.addObserver(
self,
selector: #selector(powerStateDidChange),
name: .NSProcessInfoPowerStateDidChange,
object: nil
)
}
@objc private func powerStateDidChange() {
DispatchQueue.main.async {
self.isLowPowerMode = ProcessInfo.processInfo.isLowPowerModeEnabled
}
}
}
// Usage in SwiftUI
struct AnimatedBalanceCard: View {
@EnvironmentObject var performance: PerformanceManager
var body: some View {
BalanceCardView()
.animation(
performance.isLowPowerMode ? nil : .spring(response: 0.4),
value: balance
)
}
}Low Power Mode
En mode Low Power Mode, iOS reduit la frequence de rafraichissement a 60 Hz meme sur les appareils ProMotion. Desactivez les animations Lottie et les effets visuels couteux (blur, shadow multi-couches) pour preserver la batterie et eviter les janks.
Permissions
YaniPay iOS declare 6 permissions systeme dans le fichier Info.plist. Chaque permission inclut une description utilisateur claire, conforme aux guidelines App Store Review (les descriptions vagues ou non specifiques au cas d'usage sont rejetees).
| Permission | Usage | Info.plist Key |
|---|---|---|
Face ID | Authentification et confirmation des transactions | NSFaceIDUsageDescription |
Camera | Verification KYC et scan de QR codes paiement | NSCameraUsageDescription |
NFC | Paiements sans contact Tap-to-Pay | NFCReaderUsageDescription |
Location | Decouverte des marchands a proximite | NSLocationWhenInUseUsageDescription |
Photos | Import de documents pour la verification KYC | NSPhotoLibraryUsageDescription |
Push Notifications | Alertes transactions, solde et offres de fidelite | aps-environment |
App Store Review — Permission Strings
Apple rejette systematiquement les applications avec des descriptions de permission generiques. Chaque UsageDescriptiondoit expliquer precisement comment la fonctionnalite est utilisee dans le contexte de l'application (ex: "YaniPay utilise Face ID pour confirmer vos paiements et securiser votre connexion", pas juste "Pour l'authentification").
References
Documentation officielle Apple et ressources de reference pour le developpement YaniPay iOS.
Human Interface Guidelines — standards de design iOS pour les patterns de navigation, typographie, icones et interactions.
https://developer.apple.com/design/human-interface-guidelines/Reference complete des vues, modificateurs, layouts, animations et data flow SwiftUI par Apple.
https://developer.apple.com/documentation/swiftuiDocumentation PKPaymentRequest, PassKit, tokenisation et integration Apple Pay dans les apps natives.
https://developer.apple.com/apple-pay/