SettlementDateProvider is a Swift package designed to caluclate and provide accurate settlement dates by considering country-specific bank holidays and weekends.
The package includes embedded holiday rules for supported countries, ensuring that payments and other financial transactions are processed on valid business days without requiring external configuration.
To add SettlementDateProvider to your project, include it in your Package.swift
file:
dependencies: [
.package(url: "https://github.com/msuzoagu/SettlementDateProvider.git", from: "1.0.0")
]
You can also use Xcode's GUI to add the package dependency
import SettlementDateProvider
let strategy: SettlementStrategy = .restrictive
let provider = try SettlementDateFactory().provider(
for: "US",
using: strategy,
given: [Date()]
)
let settlementDates = provider.settlementDates
import SettlementDateProvider
let provider = try SettlementDateFactory().provider(
for: "US",
given: [Date()]
)
let settlementDates = provider.settlementDates
To use SettlementDateProvider, you need to provide:
- a country code
- where - country code must be
iSO 3166-1 alpha 2
format
- where - country code must be
- a date list
- where date list is
[Date]
you want to generate settlement dates
- where date list is
- a settlement strategy
- SettlementDateProvider offers flexible strategies for determining the settlement date via
SettlementStrategy
enum:- permissive: selects closest previous valid business day before reference date
- restrictive: selects next valid business day after reference date
- SettlementDateProvider offers flexible strategies for determining the settlement date via
SettlementStrategy
defaults to.permissive
- United States
iSO 3166-1 alpha 2
format "US"