Code Monkey home page Code Monkey logo

spritz's Introduction

Spritz logo

Twitter SwiftLang badge

Spritz

Spritz is an Italian tax code (codice fiscale) generator and validator on steroids written in Swift.

It offers anything from simple regex validator, to complex analysis using the user's information, taking into account the omocodia phenomenon.

The library is fully tested and documented.

1. Requirements and Compatibility

Swift Spritz iOS
5.1+ 1.0.x 10+
5.3+ 2.0.x 10+

2. Installation

Swift Package Manager

Package.swift

Open your Package.swift file and add the following as your dependency.

dependencies: [
  .package(url: "https://github.com/TheInkedEngineer/Spritz", from: "2.0.0")
]

Then add the following to your target's dependency:

targets: [
  .target(
    name: "MyTarget", 
    dependencies: [
      .product(name: "https://github.com/TheInkedEngineer/Spritz", package: "Spritz")
    ]
  )
]

Xcode

  1. Open your app in Xcode
  2. In the Project Navigator, click on the project
  3. in the Project panel, click on the project
  4. Go to the Package Dependencies tab
  5. Click on the + button
  6. Insert the https://github.com/TheInkedEngineer/Spritz url in the search bar and press Enter
  7. Click on the Add Package button
  8. Follow the Xcode's dialog to install the SDK

3. Documentation

Spritz is fully documented. Checkout the documentation here.

4. Code Example

Generating a Codice Fiscale

let data = Spritz.Models.CodiceFiscaleData(
  firstName: "First",
  lastName: "last",
  dateOfBirth: Spritz.Models.Date(day: 2, month: .april, year: 1987)!,
  sex: .female,
  placeOfBirth: .foreign(countryName: "francia")
)

let codice = try? Spritz.generateCF(from: data)

Validating a Codice Fiscale

let result = Spritz.isValid("LSTFST89B44B354F")

Validating a Codice Fiscale against data

let data = Spritz.Models.CodiceFiscaleData(
  firstName: "First",
  lastName: "last",
  dateOfBirth: Spritz.Models.Date(day: 2, month: .april, year: 1987)!,
  sex: .female,
  placeOfBirth: .foreign(countryName: "francia")
)
    
let result = Spritz.isCorrect(fiscalCode: "LSTFST89B44B354F", for: data)

5. Contribution

Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub

spritz's People

Contributors

theinkedengineer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mattia541993

spritz's Issues

Letter month mapping is wrong

Hi, I noticed an error in mapping the months with the letters.

Comparing with the table on wikipedia, in fact, they are incorrect.

https://it.wikipedia.org/wiki/Codice_fiscale#Luogo_di_nascita

I tried to change them and fix (Transformers.swift), but in any case when calculating people born in August, October etc, I have different letters and consequently also the final check character. (if you want to write to me I am Italian. I can also write to you by email if you want)

Is a pod fix possible? Also is there a way to calculate the reverse too? Thanks so much

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.