Latest 0.1.3
Homepage https://github.com/BrooksWon/BTNSDateFormatterFactory
License MIT
Platforms ios 6.0, requires ARC
Frameworks Foundation, UIKit
Authors

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.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

BTNSDateFormatterFactory is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'BTNSDateFormatterFactory'

or

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

Usage

NSDateFormatter *dateFormatter = [[BTNSDateFormatterFactory sharedFactory] dateFormatterWithFormat:@"yyyy-MM-dd" andLocaleIdentifier:@"zh_CN"];

Author

BrooksWon, [email protected]

License

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

Latest podspec

{
    "name": "BTNSDateFormatterFactory",
    "version": "0.1.3",
    "summary": "Smart reuse of NSDateFormatter instances.",
    "homepage": "https://github.com/BrooksWon/BTNSDateFormatterFactory",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "BrooksWon": "[email protected]"
    },
    "source": {
        "git": "https://github.com/BrooksWon/BTNSDateFormatterFactory.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source_files": [
        "BTNSDateFormatterFactory",
        "BTNSDateFormatterFactory/*.{h,m}"
    ],
    "requires_arc": true,
    "frameworks": [
        "Foundation",
        "UIKit"
    ]
}

Pin It on Pinterest

Share This