Useful standards for business applications
Standards is tested on macOS, iOS, tvOS, Linux, and Windows, and is known to support the following operating system versions:
- Ubuntu 16.04+
- macOS 10.12+
- iOS 12+
- tvOS 12+
- watchOS (untested since watchOS doesn't support
XCTest
) - Windows 10 (using the latest Swift development snapshot)
Note: Tests are currently disabled on iOS, tvOS, and watchOS as xcodebuild
doesn't handle executable targets in packages for testing.`
To integrate the package:
dependencies: [
.package(url: "https://github.com/stairtree/Standards.git", from: "1.0.1")
]
While there is no standard for referring to continents, codes and names are widely used.
let africa = ISOContinents.find(byCode: "AF")!
// dump(africa)
// ▿ Standards.ContinentInfo
// - code: "AF"
// - name: "Africa"
africa.countries
// {{name "Burundi", numeric "108", alpha2 "BI", alpha3 "BDI", {…}},…
All countries currently recognized in ISO 3166-1. The data is sourced from Wikipedia for now.
let austria = ISOCountries.find(byAlpha2: "AT")!
// dump(austria)
// ▿ Standards.ISOCountryInfo
// - name: "Austria"
// - numeric: "040"
// - alpha2: "AT"
// - alpha3: "AUT"
// ▿ continents: 1 member
// - "EU"
let localized = austria.localizedName(for: .init(localeIdentifier: "de_at"))
// "Österreich"
All currencies currently recognized in ISO 4217 and currently in use. Funds are excluded. The data is sourced from ISO directly.
let canadianDollar = ISOCurrencies.find(byCode: "CAD")!
// dump(canadianDollar)
// ▿ Standards.ISOCurrencyInfo
// - name: "Canadian Dollar"
// - numeric: "124"
// - code: "CAD"
// - minorUnit: 2
canadianDollar.localizedName(for: .init(localeIdentifier: "de_at"))
// "Kanadischer Dollar"
canadianDollar.symbol
// "CA$"
All languages contained in ISO 639-1. The data is sourced from Wikipedia for now.
let bengali = ISOLanguages.find(byCode1: "bn")!
dump(bengali)
// ▿ Standards.ISOLanguageInfo
// - name: "Bengali"
// - endonym: "বাংলা"
// - family: "Indo-European"
// - code1: "bn"
// - code2T: "ben"
// - code2B: "ben"
// - code3: "ben"
bengali.localizedName(for: .init(localeIdentifier: "de_at"))
// "Bengalisch"
Human sexes as defined by ISO 5218. Note: This is not a valid representation of human gender (See awesome falsehood)! Should only be used to handle legacy IT systems or where this standard is required explicitly. Ideally this information is irrelevant and should not be required.
Run swift run update
at the root of the package to parse all sources and regenerate the various files.
All data is owned by their respective sources. Only publicly available data is used.