Giter Site home page Giter Site logo

tomleavy / dfdateformatterfactory Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dougfischer/dfdateformatterfactory

0.0 1.0 0.0 87 KB

DFDateFormatterFactory retain last NSDateFormatter instances and return them already loaded based on format and locale you want. Check README file.

Objective-C 100.00%

dfdateformatterfactory's Introduction

DFDateFormatterFactory

Smart reuse of NSDateFormatter instances.

NSDateFormatter class is very useful to display dates the way you want, handling regional settings, locales and formats.

The bad thing about NSDateFormatter is the cost to create a new instance or set format and locale. Actually these actions are one of the most slow operations on iOS SDK and you really must avoid it.

DFDateFormatterFactory is here to help you with this. This class retain the last 15 date formatter instances and return the already loaded based on format and locale you want. Also, the cache were implemented using the standard NSCache and should handle memory fine when memory warnings happens.

Read this article to understand more about expensive objects like NSDateFormatter

##Instalation

To install the DFDateFormatterFactory, just drag and drop the .h and .m files into your project folder. Import them when you need it.

##Usage

NSDateFormatter *brazilianDateFormatter = [[DFDateFormatterFactory sharedFactory] dateFormatterWithFormat:@"dd/MM/yyyy" andLocaleIdentifier:@"pt-BR"];

##Development

I'm using DFDateFormatterFactory in production apps since months ago without any issues, but you are really welcome to suggest improvements or report bugs.

dfdateformatterfactory's People

Contributors

dougfischer avatar

Watchers

James Cloos avatar

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.