A comprehensive IBAN and SWIFT/BIC validation library for Swift. Validate international bank account numbers with ISO 13616 mod-97 checksum verification, validate SWIFT/BIC codes, and extract structured components — all through natural String, Array, and Collection extensions. Perfect for fintech apps, payment forms, and banking integrations.
- 🎯 IBAN validation — Length, structure, and mod-97 checksum verification per ISO 13616.
- 🏦 SWIFT/BIC validation — Validate 8- or 11-character SWIFT/BIC codes (also available as
isBIC). - 🌍 Country awareness — Resolve the country code and human-readable country name from an IBAN.
- 🔍 Component extraction — Pull check digits, bank code, and country code from any valid IBAN.
- 🧱 SWIFT components — Extract bank, country, location, and branch codes, plus a head-office check.
- 💶 SEPA detection — Identify IBANs from Single Euro Payments Area countries.
- ✨ Normalization & formatting — Get whitespace-free normalized values or nicely spaced 4-character groups.
- 📚 Array helpers —
validIBANs,validSWIFTCodes,normalizedIBANs,normalizedSWIFTCodes,groupedByCountry,sepaIBANs,hasValidIBANs,hasValidSWIFTCodes. - 🔢 Collection counting —
validIBANCountandvalidSWIFTCountfor quick aggregates. - 🧱 Zero dependencies — Pure Foundation.
- iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+
- Swift 6.1+
- Xcode 16.0+
dependencies: [
.package(url: "https://github.com/arraypress/swift-iban-validator.git", from: "1.0.0")
]import IBANValidator
"GB82 WEST 1234 5698 7654 32".isIBAN // true
"DEUTDEFF".isSWIFT // true
"DEUTDEFF".isBIC // true (alias for isSWIFT)import IBANValidator
let iban = "DE89 3704 0044 0532 0130 00"
iban.normalizedIBAN // "DE89370400440532013000"
iban.formattedIBAN // "DE89 3704 0044 0532 0130 00"
iban.ibanCountryCode // "DE"
iban.ibanCountry // "Germany"
iban.ibanCheckDigits // "89"
iban.ibanBankCode // bank code (country-dependent)
iban.isSEPA // trueimport IBANValidator
let swift = "DEUTDEFF500"
swift.normalizedSWIFT // "DEUTDEFF500"
swift.swiftBankCode // "DEUT"
swift.swiftCountryCode // "DE"
swift.swiftLocationCode // "FF"
swift.swiftBranchCode // "500"
swift.isHeadOfficeSWIFT // falseimport IBANValidator
let ibans = ["GB82WEST12345698765432", "invalid", "DE89370400440532013000"]
ibans.validIBANs // valid entries only
ibans.normalizedIBANs // normalized valid entries
ibans.groupedByCountry // ["GB": [...], "DE": [...]]
ibans.sepaIBANs // SEPA-country IBANs only
ibans.hasValidIBANs // true
ibans.validIBANCount // 2
let codes = ["DEUTDEFF", "BADCODE", "BARCGB22"]
codes.validSWIFTCodes // ["DEUTDEFF", "BARCGB22"]
codes.normalizedSWIFTCodes // normalized valid codes
codes.hasValidSWIFTCodes // true
codes.validSWIFTCount // 2IBAN validation normalizes the input (uppercased, separators removed), checks the country-specific length, then performs the ISO 13616 mod-97 checksum: the first four characters are moved to the end, letters are converted to digits (A=10 … Z=35), and the resulting number must satisfy value mod 97 == 1. SWIFT/BIC validation enforces the 8- or 11-character structure (4 letters bank code, 2 letters country, 2 alphanumeric location, optional 3 alphanumeric branch). Country, SEPA membership, and bank-code extraction are resolved from a built-in country registry.
swift testThe test suite covers IBAN checksum validation, SWIFT/BIC structure, component extraction, SEPA detection, and the array/collection helpers.
MIT License — see LICENSE file for details.
Created by David Sherlock (ArrayPress) in 2026.