Swift value types for working with money & currency

Related tags

Text Money
Overview

Build status Coverage Status CocoaPods Compatible Carthage compatible Platform

Money

Money is a Swift framework for iOS, watchOS, tvOS and OS X. It provides types and functionality to represent, calculate and convert money in the 298 ISO currencies.


Usage

The Money framework defines the type Money, which represents money in the device’s current locale. The following code:

import Money

let money: Money = 100
print("I'll give \(money) to charity.”)

will print out

I'll give $100.00 to charity

when the region is set to United States

I'll give £100.00 to charity

when the region is set to United Kingdom

I'll give CN¥100.00 to charity

when the region is set to China

You get the idea. See Localized Formatting for more info.

Money is IntegerLiteralConvertible and FloatLiteralConvertible. Which means values can be initialized using literal Ints and Doubles as shown in these code snippets.

Specific Currency

Under the hood, Money is a typealias for _Money<Currency.Local> where Currency.Local is a specific CurrencyType which represents the currency for the current locale. This means that it is strongly typed to the local currency.

In a similar way, there are 298 foreign currency types supported.

let pounds: GBP = 99.99
let euros: EUR = 149.50

print(“You have \(pounds / 2) and \(euros + 30)”)

You have £ 50.00 and € 179.50

Because the currencies are typed, it means that they cannot be combined together.

let money = pounds + euros

Binary operator '+' cannot be applied to operands of type 'GBP' (aka '_Money<Currency.GBP>') and 'EUR' (aka '_Money<Currency.EUR>')

Of course, Money supports the usual suspects of decimal arithmetic operators, so you can add, subtract, multiply, divide values of the same type, and values with Int and Double with the expected limitations.

Convenience initializers

Money (and its friends) can be initialized with Ints (and friends) andDoubles.

let anIntegerFromSomewhereElse: Int = getAnInteger()
let money = Money(anIntegerFromSomewhereElse)

let aDoubleFromSomewhere: Double = getAnotherDouble()
let pounds = GBP(aDoubleFromSomewhere)

Minor Units

Money can be initialized using the smallest units of currency:

let dollars = USD(minorUnits: 3250)
let yuen = JPY(minorUnits: 3000)

print(“You have \(dollars) and \(yuen)”)

You have $32.50 and ¥3,000

Localized Formatting

When displaying money values, it is important that they be correctly localized for the user. In general, it’s best to use the Money type to always work in currency of the user’s current locale.

When printing a MoneyType value, the .description uses the current locale with .CurrencyStyle number style, in conjunction with NSNumberFormatter. The code snippets throughout this README uses .description whenever the value of money is printed.

However, to specify a different style for the number formatter, use the formattedWithStyle method, like this:

let money: Money = 99.99
print("She has \(money.formattedWithStyle(.CurrencyPluralStyle))")

For an American in Russia, this would print out:

She has 99,99 Russian roubles

Working with Locales

A locale is the codification of associated regional and linguistic attributes. A locale varies by language and region. Each locale has an identifier, which is the concatenation of language, country and modifier codes.

The language code is two or three lowercase letters. English is en, French is fr. There is a long list. Some languages are spoken in more than one country, in which case a country code (two uppercase letters) is appended (with an underscore). For example, English in the United States is en_US, which is the default locale in the iOS Simulator. English in the United Kingdom is en_GB.

Lastly, a locale identifier can be modified, say for example to set the currency code to “USD”, for Portuguese speaking user in Brazil, the locale identifier would be pt_BR@currency=USD.

In total, NSLocale has support for ~ 730 distinct locales. Typically when creating a specific NSLocale it is done with the locale identifier. The NSLocale is like a dictionary with an objectForKey method which returns AnyObject!.

Formatting for specific Locale

I think NSLocale is an amazing class, but it’s very easy to make mistakes, and not that easy to construct. Therefore, to support arbitrary locales, but remove the need for framework consumers to construct locale identifiers, a new Locale type is provided. This is an enum which means that it is type safe, and indexable for code completion in Xcode. Its cases are all the languages which NSLocale supports. For those languages which are spoken in more than one country, there is an associated value of country names of only those counties.

To format money for a specific locale we can use the Locale enum. The following code uses Locale.Chinese(.China) to represent the "zh_CN" locale.

let money: Money = 99.99
print("She has \(money.formattedWithStyle(.CurrencyPluralStyle, forLocale: .Chinese(.China)))")

Now, for our American in Russia, (or any user with a region set to Russia) we get:

She has 99.99俄罗斯卢布

In this case, because our type is Money, and the user’s region is set to Russia, we’re working with RUB currency. But equally, if we need money in a specific currency, we can. Here’s Australian dollars, for a SwissGerman speaking user, in France.

let dollars: AUD = 39.99
print("You’ll need \((dollars / 2.5).formattedWithStyle(.CurrencyPluralStyle, forLocale: .SwissGerman(.France)))")

Regardless of the user’s current locale, this will print out:

You’ll need 16.00 Auschtralischi Dollar

 Pay

On iOS (not watchOS, tvOS or OS X), there is support in Money for using Money with  Pay.

Create a PaymentSummaryItem in lieu of PKPaymentSummaryItem with a suitable MoneyType:

import PassKit

typealias DollarItem = PaymentSummaryItem<USD>

let items = [
    DollarItem(label: "Something fancy.", cost: 9.99),
    DollarItem(label: "Something less fancy.", cost: 5.99)
]

let request = PKPaymentRequest(items: items, sellerName: "Acme, Inc.")

The convenience initializer receives an array of PaymentSummaryItem values and a seller name. It sets the currency code and payment summary items. Following the  Pay guidelines, will append a total summary item using the provided seller name.

PaymentSummaryItem conforms to Hashable and ValueCoding.

Bitcoin

Money has support for Bitcoin types, the popular BTC and the unofficial ISO 4217 currency code XBT.

In November 2015, the Unicode consortium accepted U+20BF as the Bitcoin symbol. However, right now that means it is not available in Foundation. Therefore, currently the Bitcoin currency type(s) use Ƀ, which is also a popular symbol and available already within Unicode.

To work with Bitcoin, use the following:

let bitcoin: BTC = 0.1234_5678
print(“You have \(bitcoin)”)

You have Ƀ0.12345678

Foreign Exchange (FX)

The FX support which was previously part of this framework has been moved into its own, called FX.

Creating custom currencies

If your app has its own currency e.g. ⭐️ s or 💎 s or even 🐝 s, you might want to consider making a type for it.

Lets imagine we’re making Hive.app - where you compete with your friends to see who can get the biggest hive (measured in number of 🐝 s).

To create a custom currency, just conform to CurrencyType.

protocol HiveCurrencyType: CustomCurrencyType { }

extension Currency {
    final class Bee: HiveCurrencyType {

        static let code: String = "BEES"
        static let symbol: String = "🐝"
        static let scale: Int  = 0
    }
}

typealias Bees = _Money<Currency.Bee>

Just make sure that your currency code doesn’t clash with a real one - make it more than three characters to be sure.

Now it’s possible to work with your own app’s currency as a proper money type.

let bees: Bees = 10_000
print(“I have \(bees)”)

I have 🐝 10,000

And of course if you have an IAP for purchasing in-app currency, then I’m sure a custom FX provider would be handy.

Take a look at the example project, Custom Money, for an example of a custom local FX provider to exchange your 🐝 s.

Installation

Money builds as a cross platform (iOS, OS X, watchOS) extension compatible framework. It is compatible with Carthage. It is also available via CocoaPods.

pod ‘Money’

At of writing there are some issues with the CocoaDocs generator for pure Swift 2 projects. This means that the project doesn’t have a page/docs in CocoaPods sites, however they are available through Xcode.


Architectural style

Swift is designed to have a focus on safety, enabled primarily through strong typing. This framework fully embraces this ethos and uses generics heavily to achieve this goal.

At the highest level currency is modeled as a protocol, CurrencyType. The protocol defines a few static properties like its symbol, and currency code. Therefore money is represented as a decimal number with a generic currency. Additionally, we make CurrencyType refine the protocol which defines how the decimal number behaves.

Finally, we auto-generate the code which defines all the currencies and money typealiases.

Implementation Details

Cocoa has two type which can perform decimal arithmetic, these are NSDecimalNumber and NSDecimal. NSDecimal is faster, but is trickier to work with, and doesn’t have support for limiting the scale of the numbers (which is pretty important when working with currencies).

DecimalNumberType is a protocol which refines SignedNumberType and defines its own functions, add, subtract etc to support the arithmetic. It is generic over two types, the underlying storage, and the behaviors.

DecimalNumberType.DecimalStorageType exists so that conforming types can utilize either NSDecimalNumber or NSDecimal as their underling storage type.

DecimalNumberBehavior is a protocol which exposes a NSDecimalNumberBehaviors which should be used in calculations. This includes rounding style, scale, and when to throw exceptions.

_Decimal

Which leads us to _Decimal<Behavior: DecimalNumberBehavior> which is a value type implementing DecimalNumberType with an NSDecimalNumber storage type.

There are two public typealiases for convenience.

/// `Decimal` with plain decimal number behavior
public typealias Decimal = _Decimal<DecimalNumberBehavior.Plain>

/// `BankersDecimal` with banking decimal number behavior
public typealias BankersDecimal = _Decimal<DecimalNumberBehavior.Bankers>

This means, that Decimal is more than likely the type to use for most things.

_Money

The _Money<C: CurrencyType> type composes a _Decimal<C>. Its behavior is provided via its generic CurrencyType which refines DecimalNumberBehavior. _Money also conforms to DecimalNumberType which means that it can also be used with the operators.

Why not use NSDecimal?

NSDecimal would be a better storage type for _Decimal, however it doesn’t have the full NSDecimalNumberBehaviors support that NSDecimalNumber enjoys. In particular, specifying the scale is problematic. If anyone has any smart ideas, please get in touch. I’ve added an equivalent extension on NSDecimal as for NSDecimalNumber.

ValueCoding

Both _Decimal, _Money and FXTransaction all conform to ValueCoding which means they can be encoded and stored inside archives.

Author

Daniel Thorpe @danthorpe.

Feel free to get in contact if you have questions, queries, suggestions, or need help. Especially get in contact via an Issue here or on Twitter if you want to add support for another FX service provider.

I wrote an introductory blog post about money here.

License

Money is available under the MIT license. See the LICENSE file for more info.

Disclaimer

Usage of this framework prevents the author, Daniel Thorpe, from being held liable for any losses incurred by the user through their use of the framework.

Comments
  • Add support for localized description - i.e. use language associated with currency.

    Add support for localized description - i.e. use language associated with currency.

    In some countries, such as France/Germany/Italy/Spain, the Euro sign is placed after the amount. E.g. 3,50 € (note that they also use a ',' instead of '.' for sub units). More information can be found here: https://en.wikipedia.org/wiki/Euro_sign#Use

    opened by mrdavey 10
  • Update dependency Result to non-beta version

    Update dependency Result to non-beta version

    In this file: https://github.com/danthorpe/Money/blob/development/Money.podspec, it shows a dependency:

    s.dependency 'Result', '0.6.0-beta.6'
    

    The beta version number causes a CFBundleVersion error when uploading to iTunes, as per this Stackoverflow thread: http://stackoverflow.com/a/33375436/4769084

    My interim solution was to manually update the info.plist file of the pod, however using a non-beta dependency would probably be better.

    bug 
    opened by mrdavey 9
  • dyld: Library not loaded: @rpath/Money.framework/Money

    dyld: Library not loaded: @rpath/Money.framework/Money

    Hello,

    I just run a simple iOS app with Money.framework and it is crash when running with error:

    dyld: Library not loaded: @rpath/Money.framework/Money Referenced from: /var/containers/Bundle/Application/206D71A3-3278-4DEE-8C0C-41A65C237AC4/MobileOAM.app/MobileOAM Reason: image not found

    I don't know what image is ?

    P/s: XCode 9.2, Swift4, Mac OS X 10.13.3(High Sierra)

    opened by SubbaNelakudhiti 8
  • Impossible to build the project on Xcode 7.2 with Carthage

    Impossible to build the project on Xcode 7.2 with Carthage

    This cartfile

    github "danthorpe/Money" ~> 1.6.0

    With Carthage 0.12.0 and Xcode 7.2.1 produces this output:

    $ carthage update Money --platform iOS
    *** Fetching Money
    *** Fetching ValueCoding
    *** Checking out Money at "1.6.0"
    *** Checking out ValueCoding at "1.2.0"
    *** xcodebuild output can be found in /var/folders/mf/0kc1sz9n17s12drx20lnkh7r0000gn/T/carthage-xcodebuild.YN4lFV.log
    *** Building scheme "ValueCoding-iOS" in ValueCoding.xcodeproj
    *** Building scheme "Money-iOS" in Money.xcodeproj
    *** Building scheme "Money" in Custom Money.xcworkspace
    ** BUILD FAILED **
    
    
    The following build commands failed:
        CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
    (1 failure)
    <unknown>:0: error: no such file or directory: '/Users/user/Documents/Xcode Projects/project/Carthage/Checkouts/Money/Money/Shared/FX/Bitcoin.swift'
    A shell task failed with exit code 65:
    ** BUILD FAILED **
    
    
    The following build commands failed:
        CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
    (1 failure)
    
    

    I hope this will help. :smile:

    fixed 
    opened by CallMeSH 6
  • Refactor FX functionality into danthorpe/FX repository.

    Refactor FX functionality into danthorpe/FX repository.

    Perhaps not a huge deal but it does seem a bit weird for a money formatting library to depend on a JSON parsing library. Is this a necessary dependency? I presume this will mean that most apps that include Money end up including two JSON libraries in their applications, unintentionally.

    opened by irace 6
  • Currency is truncated

    Currency is truncated

    Hello,

    I have a double value of 3.99 for example, and Money displays £3. Any ideas?

    let money = Money(availability.lowestPrice.doubleValue)
    
    let buttonString = "\(money) \(availability.buyacion)"
    
    bug fixed 
    opened by cyril94440 4
  • Multiply and Divide factors should be a non-unit scaler

    Multiply and Divide factors should be a non-unit scaler

    Shouldn't the operations support $11.50 * 10 and not $11.50 * $10? You want the same units with addition and subtraction but it doesn't make sense with multiplication and division.

    opened by wildthink 4
  • Able to pass NSLocale to formatter

    Able to pass NSLocale to formatter

    let money: Money = 99.99
    print("She has \(money.formattedWithStyle(.CurrencyPluralStyle, forLocale: .Chinese(.China)))")
    

    Ability to pass NSLocale to the forLocale param

    opened by wess 3
  • Getting Array of All Available Currencies

    Getting Array of All Available Currencies

    Hello,

    I was searching through the source code trying to find a method that would return a list of all currencies. Is this possible? I'm trying to create a very simple application that allows users to be able to select currencies from a list and add them to their "preferred" currencies.

    I hope this is the right place to ask these questions, and thanks for your help!

    opened by morluna 2
  • How to get Double value as the same Money value?

    How to get Double value as the same Money value?

    Hello! I was faced with incorrect converting to Double. For example I have a value of SGD 99.68, when I take a Double value, it turns out I 98.679999999999993 so, how do I get the value of a level 99.68 as a Double?

    opened by alexanderkhitev 2
  • How to get an instance of Money based on a string symbol?

    How to get an instance of Money based on a string symbol?

    Hi everyone,

    Here what I'm trying to do, please let me know if my way of thinking if the mistake here.

    I received a symbol (EUR, CHF, USD...) as a string from a fermer, and I have it associated with my store's object (in a way that this defines what currency the stores accepts).

    My idea here was to simply create a currency variable, from Money, on the store's object and then call if every time I would bee some conversion/presentation to be done.

    So it would be like this:

    print("You have to pay \(StoreObject.currency(100))")

    Can I do this using the actual Money library or is there any other way to do that?

    Thank you!

    duplicate 
    opened by aliasbody 2
  • Using a variable for multiple currencies

    Using a variable for multiple currencies

    I have an app where the user selects one of a set of regions for the app to run in and all the money amounts need to use the currency for that region. I can't work out how to have variables that can be set to any of the strongly typed currency types (e.g. AUD, NZD) since Swift disallows the use of runtime defined Generics types. If I use Money type and force it to a specific currency, its fine until I do any operations that generate a new Money object (such as adding two Money objects), which causes the new Money object to be set to local region instead of the forced region I was using.

    I'm using the Swift 4 branch.

    Any Ideas on how to do this?

    opened by tplester 0
  • I can't able to display the currency like $1.00 or $100, but I can able to display currency $1.01, $100.25 like that with decimals.

    I can't able to display the currency like $1.00 or $100, but I can able to display currency $1.01, $100.25 like that with decimals.

    Here's how I code. class statement { var amountDue: Money? } statement.amountDue = 100.00 It displays as $ in the UI Screen, but when I used statement.amountDue = 100.25 it's showing properly on UI.

    My pod 'Money', '~> 4.0.0' Working on Swift 4.0.

    opened by SubbaNelakudhiti 0
  • Rewrite for Xcode 9 & Swift 3.2

    Rewrite for Xcode 9 & Swift 3.2

    Xcode 9 snuck in some quite interesting breaking changes with Swift 3.2 and numeric protocols. In particular Numeric, SignedNumeric, FloatingPoint and SignedNumber which no longer exists properly.

    Additionally, Decimal is now a value type bridged to NSDecimalNumber but which does not provide a full implementation of FloatingPoint yet, but it does still expose decimal math operations (methods are now deprecated in favour of operators). The Decimal operators use .plain rounding mode.

    So, this PR is pretty much the start of a complete re-write of Money, and what will eventually become v3. This PR is focused on getting core functionality working. To that end we have:

    • [x] CurrencyProtocol - protocol which provides currency description info

    • [x] MoneyProtocol - protocol which provides math functionality

    • [x] Money which is for weakly typed currency (defaults to "device") - and provides an API entry point to eventually support dynamic money where the currency is unknown at compile time.

    • [x] ISOMoney which is for money with a strongly typed currency, known at compile time. e.g. USD, and should have the same API as v2 types.

    • [x] Autogenerated typealiases for ISO money

    • [x] Localised formatting of Money values

    Things which are currently missing

    • [ ] Codable support.
    • [ ] ApplePay extensions
    • [ ] Bitcoin/Crypto Currencies
    opened by danthorpe 35
Releases(2.0.1)
  • 2.0.1(Dec 12, 2016)

  • 2.0.0(Oct 19, 2016)

  • 1.8.0(Oct 16, 2016)

  • 1.7.0(Mar 23, 2016)

  • 1.6.2(Mar 12, 2016)

  • 1.6.1(Mar 10, 2016)

  • 1.6.0(Feb 28, 2016)

    1.6.0

    1. [MNY-39]: Updates the spelling of CocoaPods, thanks https://github.com/ReadmeCritic!
    2. [MNY-34]: Refactors CurrencyType to remove the formatter property, and include a default CurrencyStyle. This update makes it a lot easier to make custom currency types, and overall improves or fixes bugs with the ISO currency types. If you have custom currencies you may need to perform some slight refactoring, but it shouldn’t be too complex.
    Source code(tar.gz)
    Source code(zip)
  • 1.5.1(Feb 6, 2016)

  • 1.5.0(Feb 6, 2016)

  • 1.4.2(Dec 16, 2015)

  • 1.4.1(Nov 25, 2015)

  • 1.4.0(Nov 24, 2015)

    1.4.0

    1. [MNY-25]: Adds convenience initializers to DecimalNumberType for Int (including all the variants) and Double parameters. Although not technically needed, (as it’s integer and float convertible) this makes it a lot easier to construct Money types.
    2. [MNY-24]: Refactors the localized string formatting APIs. Fixed a few bugs which may have rendered string incorrectly formatted in some locales. Also added the ability to format MoneyType values using specific language and country locales. See the README for more info.
    3. [MNY-27]: Finally got Jazzy to generate the documentation, and have created a config for the project. Hopefully now CocoaDocs will correctly parse the framework and generate docs. Documentation coverage is 96%.
    Source code(tar.gz)
    Source code(zip)
    Money.framework.zip(16.11 MB)
  • 1.3.0(Nov 19, 2015)

    1.3.0

    1. [MNY-21, MNY-22]: Adds support for initializing MoneyTypes with minor units. Thanks to @jlalvarez18.
    2. [MNY-23]: Adds some convenience extensions to create Pay payment requests using an array of PaymentSummaryItem which is a new type generic over MoneyType. This is only available on iOS, and it allows consumers to use Money directly with Pay APIs.
    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Nov 14, 2015)

    1.2.1

    1. [MNY-19]: Fixes a bunch of miscellaneous spelling mistakes in the README and code documentation.
    2. [MNY-20]: Fixes a mistake where DVR, which is only needed for the test suite, was not in a private Cartfile. Also switches to the official @venmo DVR after recent merges in their project. Thanks to @dasmer for this.
    Source code(tar.gz)
    Source code(zip)
    Money.framework.zip(15.71 MB)
  • 1.2.0(Nov 8, 2015)

    1.2.0

    1. [MNY-18]: Adds Bitcoin currency types and support for % commission with FX.
      • Creates BTC and XBT types.
      • Refactors FXQuote into a struct (no longer subclass-able) but with a percentage commission property. Commission defaults to 0%.
      • FX method quote, now returns FXTransaction as the value of the Result. This new value type composes the original base money, commission (in the same base money currency), the exchange rate, and the counter money. The type supports ValueCoding.
      • A new FX provider, CEX.IO get support for buying and selling bitcoin using USD, EUR and RUB.
    Source code(tar.gz)
    Source code(zip)
    Money.framework.zip(15.62 MB)
  • 1.1.0(Nov 6, 2015)

    1.1.0

    1. [MNY-16]: Grab bag of minor issues post 1.0 release.
      • Cleans up some minor mistakes (spelling etc).
      • Adds NSCoding conformance to FXQuote - so it can be persisted if needed.
      • Adds FXRemoteProviderType.quote(: BaseMoney, completion: Result<(BaseMoney, FXQuote, CounterMoney), FXError> -> Void) -> NSURLSessionDataTask API. This is the nuts and bolts of the FX provider now. It returns as its result, the base money (i.e. the input), the quote (which includes the rate), and the counter money (i.e. the output). The fx method still exists, and it just unwraps the tuple to return the counter money. See the updated README.
    2. [MNY-17]: There was an oversight in the functions in DecimalNumberType which accepts NSDecimalNumberBehaviors as an argument. These were unnecessary so I’ve removed them. Hence the minor version bump.
    Source code(tar.gz)
    Source code(zip)
    Money.framework.zip(14.28 MB)
  • 1.0.0(Nov 5, 2015)

    1.0.0

    🎉🐝 Initial release of Money.

    • [x] DecimalNumberType with full support for mathematics operators
    • [x] Strongly typed ISO currencies
    • [x] Strongly typed ISO money type which conforms to DecimalNumberType
    • [x] Generic Foreign Exchange APIs
    • [x] Yahoo FX provider
    • [x] OpenExchangeRates.org FX provider
    • [x] 100% of code covered by tests
    Source code(tar.gz)
    Source code(zip)
    Money.framework.zip(14.20 MB)
Owner
Daniel Thorpe
Daniel Thorpe
BonMot is a Swift attributed string library

BonMot (pronounced Bon Mo, French for good word) is a Swift attributed string library. It abstracts away the complexities of the iOS, macOS, tvOS, and

Rightpoint 3.4k Dec 30, 2022
Croc is a swift emoji string parsing library

Croc is a library for parsing emojis on iOS. It provides a simple and lightweight interface for detecting, generating, categorizing and managing emoji characters, making emoji-powered features an easy task for developers.

Joe Kalash 127 Nov 20, 2022
Fully open source text editor for iOS written in Swift.

Edhita Fully open source text editor for iOS written in Swift. http://edhita.bornneet.com/ What Edhita means? Edhita (Romaji) == エディタ (Katakana) == Ed

Tatsuya Tobioka 1.2k Jan 1, 2023
A simple and customizable Markdown Parser for Swift

MarkdownKit MarkdownKit is a customizable and extensible Markdown parser for iOS and macOS. It supports many of the standard Markdown elements through

Bruno Oliveira 687 Dec 18, 2022
Marky Mark is a parser written in Swift that converts markdown into native views.

Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported markdown syntax is easy to extend.

M2mobi 287 Nov 29, 2022
Swift Parser Combinators

Parsey Swift Parser Combinator Framework In addition to simple combinators, Parsey supports source location/range tracking, backtracking prevention, a

Richard Wei 56 Jun 30, 2022
Great Swift String Pluralize Extension

Pluralize.swift Great Swift String Pluralize Extension case-insensitive tons of rules for irregular nouns (plural form) supports uncountable nouns all

Joshua Arvin Lat 193 Nov 8, 2022
An NSPredicate DSL for iOS, OSX, tvOS, & watchOS. Inspired by SnapKit and lovingly written in Swift.

PrediKit A Swift NSPredicate DSL for iOS & OS X inspired by SnapKit, lovingly written in Swift, and created by that weird dude at KrakenDev. If you're

Hector Matos 542 Sep 24, 2022
PySwiftyRegex - Easily deal with Regex in Swift in a Pythonic way

PySwiftyRegex Easily deal with Regex in Swift in a Pythonic way.

Ce Zheng 232 Oct 12, 2022
Regular expressions for swift

Regex Advanced regular expressions for Swift Goals Regex library was mainly introduced to fulfill the needs of Swift Express - web application server

Crossroad Labs 328 Nov 20, 2022
👩‍🎨 Elegant Attributed String composition in Swift sauce

Elegant Attributed String composition in Swift sauce SwiftRichString is a lightweight library which allows to create and manipulate attributed strings

Daniele Margutti 2.9k Jan 5, 2023
SwiftVerbalExpressions is a Swift library that helps to construct difficult regular expressions

SwiftVerbalExpressions Swift Regular Expressions made easy SwiftVerbalExpressions is a Swift library that helps to construct difficult regular express

null 582 Jun 29, 2022
A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber.

PhoneNumberKit Swift 5.3 framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber. Features F

Roy Marmelstein 4.7k Jan 8, 2023
A comprehensive, lightweight string extension for Swift

SwiftString SwiftString is a lightweight string extension for Swift. This library was motivated by having to search StackOverflow for common string op

Andrew Mayne 1.6k Dec 30, 2022
A Swift Formatter Kit

Format A Swift formatter kit. Simple formatting syntax for decimal numbers, currency, mass, addresses, ordinal numbers and hexadecimal colors. Usage I

Roy Marmelstein 1.2k Nov 8, 2022
🌭 Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it.

Mustard ?? Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it. Quick start using character sets Foundation

Mathew Sanders 695 Nov 11, 2022
Automatic summarizer text in Swift

Overview Reductio is a tool used to extract keywords and phrases using an implementation of the algorithm TextRank. Installation Swift Package Manager

Sergio Fernández 438 Dec 9, 2022
OysterKit is a framework that provides a native Swift scanning, lexical analysis, and parsing capabilities. In addition it provides a language that can be used to rapidly define the rules used by OysterKit called STLR

OysterKit A Swift Framework for Tokenizing, Parsing, and Interpreting Languages OysterKit enables native Swift scanning, lexical analysis, and parsing

Swift Studies 178 Sep 16, 2022
Swift markdown library

Markdown ![Swift version](https://img.shields.io/badge/Swift-2.1 | 2.2-blue.svg) ![GitHub license](https://img.shields.io/badge/license-LGPL v3-green.

Crossroad Labs 79 Oct 9, 2022