This file provides guidance to LLMs when working with code in this repository.
IMPORTANT: This is the v6 major version branch. All v6 development PRs should target develop.
Adyen iOS is a modular payment SDK providing both Drop-in (all-in-one) and Components (individual payment methods) integration options. The SDK handles payment method selection, details entry, 3DS authentication, and various payment actions.
Minimum Requirements:
- iOS 16.0+
- Xcode 15.0+
- Swift 5.7+
Main Branch for v6 PRs: develop
The SDK is organized into focused, independent modules:
- Adyen: Core module with fundamental types (
PaymentMethod,Componentprotocols,AdyenContext, networking, analytics) - AdyenUI: Reusable UI components (forms, lists, styles, theming). Provides
FormViewController, form items, and the style system - AdyenCard: Card payment components including encryption, validation, and 3DS2 handling
- AdyenComponents: Individual payment method components (SEPA, iDEAL, BLIK, etc.)
- AdyenActions: Action handlers (redirects, vouchers, QR codes, 3DS challenges)
- AdyenDropIn: Complete payment flow orchestrator using MVVM-Router pattern
- AdyenSession: Simplified checkout flow managing
/sessionsendpoint integration - AdyenEncryption: Client-side encryption for sensitive payment data
- AdyenSwiftUI: SwiftUI-specific helpers and utilities
- AdyenCheckout: Umbrella module combining all payment functionality
- AdyenWeChatPay, AdyenCashAppPay, AdyenTwint: Platform-specific payment methods
Component Protocol System:
All payment methods implement the PaymentMethod protocol and build corresponding components via PaymentComponentBuilder. Components communicate through delegates (PaymentComponentDelegate, ActionComponentDelegate).
Drop-in Architecture:
Uses MVVM-Router pattern with modular assemblies. The DropInComponent coordinates between PaymentMethodListComponent, individual payment components, and action handlers. Navigation is managed through DropInRouter and module-specific routers.
Session Flow:
AdyenSession wraps the simplified checkout flow, internally handling /payments and /payment/details calls. It acts as a delegate to components and provides feedback through AdyenSessionDelegate.
Theming System:
Centralized styling through FormComponentStyle, ListComponentStyle, etc. All visual components accept style parameters allowing full customization of colors, fonts, spacing, and corner radius.
Form Architecture:
Forms are built using FormItem types (text fields, buttons, pickers, toggles) managed by FormViewController. Each item has a corresponding view and validator. The form system is reactive, with items publishing value changes.
Build the project:
xcodebuild -project Adyen.xcodeproj -scheme Adyen -configuration Debug buildFor detailed testing guidance including test commands, patterns, and best practices, see TESTING.md.
SwiftLint:
swiftlintSwiftFormat (check):
swiftformat --lint .SwiftFormat (apply):
swiftformat .Two demo apps are available in the Demo/ directory:
Demo/UIKit/- UIKit-based implementation examplesDemo/SwiftUI/- SwiftUI-based implementation examples
Both demonstrate Drop-in and Components integration patterns.
Follow this structure:
[purpose]: [Commit message: starts with verb, imperative mood]
Purpose prefixes:
feature- public API incrementsdeprecate- deprecated public API flaggingremove- deprecated API removaldocs- documentation changeschore- non-public API changes or refactoringfix- bug fixes
Examples:
chore: Update tests
feature: Add method xxx(aaa:bbb) to YYYY
fix: Resolve race condition in session handler
- Line length: 140 characters (warning)
- File length: 500 lines (warning)
- Identifier min length: 2 characters
- SwiftFormat is configured with inline commas, no space ranges, and specific wrapping rules
- All files must include copyright header (auto-applied by SwiftFormat)
IMPORTANT: Always run SwiftFormat after editing Swift files
After making any code changes using editing tools, always run SwiftFormat to ensure compliance with the project's formatting rules:
# Format a single file
swiftformat path/to/edited/file.swift
# Format multiple files
swiftformat AdyenUI/UI/Form/Items/Text/This prevents unintended whitespace changes and formatting inconsistencies that create noise in pull request diffs and increase reviewer burden.
Prefer package access for new internal APIs.
Use @_spi(AdyenInternal) only when internal cross-module exposure is truly needed and package cannot satisfy the requirement.
When touching nearby existing @_spi usage, prefer migrating to package where safe.
The SDK uses explicit access control levels (explicit_acl SwiftLint rule is enabled).
Modules have clear dependency chains:
AdyenUIdepends onAdyenAdyenCarddepends onAdyen,AdyenEncryption,AdyenUIAdyenDropIndepends onAdyen,AdyenCard,AdyenComponents,AdyenActionsAdyenSessiondepends onAdyen,AdyenActions
When modifying code, be mindful of these dependencies to avoid circular references.
The SDK is built with BUILD_LIBRARY_FOR_DISTRIBUTION enabled for binary compatibility. Protocol extensions must provide default implementations for this reason (see PaymentMethod.buildComponent for example).
AdyenWeChatPay and AdyenTwint cannot run on simulators - they require physical devices for testing.
Localization keys are generated automatically. After modifying .strings files, run:
swift Scripts/generate_localization_keys.swiftThe project uses GitHub Actions for CI with the following key workflows:
- verify-os-compatibility.yml: Runs tests on multiple iOS versions (iOS 16, 17, 18)
- pr_scan.yml: Runs linting and validation on pull requests
- test-SPM-integration.yml: Validates Swift Package Manager integration
- test_cocoapods_integration.yml: Validates CocoaPods integration