diff --git a/Example/AppDelegate.h b/Example/AppDelegate.h old mode 100644 new mode 100755 diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m old mode 100644 new mode 100755 diff --git a/Example/Default-568h@2x.png b/Example/Default-568h@2x.png old mode 100644 new mode 100755 diff --git a/Example/RelativeDateDemo-Info.plist b/Example/RelativeDateDemo-Info.plist old mode 100644 new mode 100755 diff --git a/Example/RelativeDateDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/RelativeDateDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/Example/RelativeDateDemo_Prefix.pch b/Example/RelativeDateDemo_Prefix.pch old mode 100644 new mode 100755 diff --git a/Example/TesterViewController.h b/Example/TesterViewController.h old mode 100644 new mode 100755 diff --git a/Example/TesterViewController.m b/Example/TesterViewController.m old mode 100644 new mode 100755 diff --git a/Example/ca.lproj/TesterViewController.xib b/Example/ca.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/de.lproj/TesterViewController.xib b/Example/de.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/en.lproj/TesterViewController.xib b/Example/en.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/es.lproj/TesterViewController.xib b/Example/es.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/fr.lproj/TesterViewController.xib b/Example/fr.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/it.lproj/TesterViewController.xib b/Example/it.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/ja.lproj/TesterViewController.xib b/Example/ja.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/main.m b/Example/main.m old mode 100644 new mode 100755 diff --git a/Example/nb.lproj/TesterViewController.xib b/Example/nb.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/nl.lproj/TesterViewController.xib b/Example/nl.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/pt.lproj/TesterViewController.xib b/Example/pt.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/zh-Hans.lproj/TesterViewController.xib b/Example/zh-Hans.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/Example/zh-Hant.lproj/TesterViewController.xib b/Example/zh-Hant.lproj/TesterViewController.xib old mode 100644 new mode 100755 diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/SORelativeDateTransformer.podspec b/SORelativeDateTransformer.podspec old mode 100644 new mode 100755 diff --git a/SORelativeDateTransformer.xcodeproj/project.pbxproj b/SORelativeDateTransformer.xcodeproj/project.pbxproj new file mode 100755 index 0000000..da88f10 --- /dev/null +++ b/SORelativeDateTransformer.xcodeproj/project.pbxproj @@ -0,0 +1,299 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E32DE5481B6ABD8E00E6AA46 /* SORelativeDateTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = E32DE5471B6ABD8E00E6AA46 /* SORelativeDateTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E32DE55F1B6ABE3E00E6AA46 /* SORelativeDateTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = E32DE55E1B6ABE3E00E6AA46 /* SORelativeDateTransformer.m */; }; + E32DE5611B6ABE4400E6AA46 /* SORelativeDateTransformer.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E32DE5601B6ABE4400E6AA46 /* SORelativeDateTransformer.bundle */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E32DE5421B6ABD8E00E6AA46 /* SORelativeDateTransformer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SORelativeDateTransformer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E32DE5461B6ABD8E00E6AA46 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E32DE5471B6ABD8E00E6AA46 /* SORelativeDateTransformer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SORelativeDateTransformer.h; sourceTree = ""; }; + E32DE55E1B6ABE3E00E6AA46 /* SORelativeDateTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SORelativeDateTransformer.m; sourceTree = ""; }; + E32DE5601B6ABE4400E6AA46 /* SORelativeDateTransformer.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SORelativeDateTransformer.bundle; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E32DE53E1B6ABD8E00E6AA46 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E32DE5381B6ABD8E00E6AA46 = { + isa = PBXGroup; + children = ( + E32DE5441B6ABD8E00E6AA46 /* SORelativeDateTransformer */, + E32DE5431B6ABD8E00E6AA46 /* Products */, + ); + sourceTree = ""; + }; + E32DE5431B6ABD8E00E6AA46 /* Products */ = { + isa = PBXGroup; + children = ( + E32DE5421B6ABD8E00E6AA46 /* SORelativeDateTransformer.framework */, + ); + name = Products; + sourceTree = ""; + }; + E32DE5441B6ABD8E00E6AA46 /* SORelativeDateTransformer */ = { + isa = PBXGroup; + children = ( + E32DE5471B6ABD8E00E6AA46 /* SORelativeDateTransformer.h */, + E32DE55E1B6ABE3E00E6AA46 /* SORelativeDateTransformer.m */, + E32DE5601B6ABE4400E6AA46 /* SORelativeDateTransformer.bundle */, + E32DE5451B6ABD8E00E6AA46 /* Supporting Files */, + ); + path = SORelativeDateTransformer; + sourceTree = ""; + }; + E32DE5451B6ABD8E00E6AA46 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E32DE5461B6ABD8E00E6AA46 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + E32DE53F1B6ABD8E00E6AA46 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + E32DE5481B6ABD8E00E6AA46 /* SORelativeDateTransformer.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + E32DE5411B6ABD8E00E6AA46 /* SORelativeDateTransformer */ = { + isa = PBXNativeTarget; + buildConfigurationList = E32DE5581B6ABD8E00E6AA46 /* Build configuration list for PBXNativeTarget "SORelativeDateTransformer" */; + buildPhases = ( + E32DE53D1B6ABD8E00E6AA46 /* Sources */, + E32DE53E1B6ABD8E00E6AA46 /* Frameworks */, + E32DE53F1B6ABD8E00E6AA46 /* Headers */, + E32DE5401B6ABD8E00E6AA46 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SORelativeDateTransformer; + productName = SORelativeDateTransformer; + productReference = E32DE5421B6ABD8E00E6AA46 /* SORelativeDateTransformer.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E32DE5391B6ABD8E00E6AA46 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0640; + ORGANIZATIONNAME = "Standard Orbit Software, LLC"; + TargetAttributes = { + E32DE5411B6ABD8E00E6AA46 = { + CreatedOnToolsVersion = 6.4; + }; + }; + }; + buildConfigurationList = E32DE53C1B6ABD8E00E6AA46 /* Build configuration list for PBXProject "SORelativeDateTransformer" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = E32DE5381B6ABD8E00E6AA46; + productRefGroup = E32DE5431B6ABD8E00E6AA46 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E32DE5411B6ABD8E00E6AA46 /* SORelativeDateTransformer */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E32DE5401B6ABD8E00E6AA46 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E32DE5611B6ABE4400E6AA46 /* SORelativeDateTransformer.bundle in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E32DE53D1B6ABD8E00E6AA46 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E32DE55F1B6ABE3E00E6AA46 /* SORelativeDateTransformer.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + E32DE5561B6ABD8E00E6AA46 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + E32DE5571B6ABD8E00E6AA46 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + E32DE5591B6ABD8E00E6AA46 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = SORelativeDateTransformer/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + E32DE55A1B6ABD8E00E6AA46 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = SORelativeDateTransformer/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E32DE53C1B6ABD8E00E6AA46 /* Build configuration list for PBXProject "SORelativeDateTransformer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E32DE5561B6ABD8E00E6AA46 /* Debug */, + E32DE5571B6ABD8E00E6AA46 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E32DE5581B6ABD8E00E6AA46 /* Build configuration list for PBXNativeTarget "SORelativeDateTransformer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E32DE5591B6ABD8E00E6AA46 /* Debug */, + E32DE55A1B6ABD8E00E6AA46 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E32DE5391B6ABD8E00E6AA46 /* Project object */; +} diff --git a/SORelativeDateTransformer.xcodeproj/xcshareddata/xcschemes/SORelativeDateTransformer.xcscheme b/SORelativeDateTransformer.xcodeproj/xcshareddata/xcschemes/SORelativeDateTransformer.xcscheme new file mode 100755 index 0000000..6b148bb --- /dev/null +++ b/SORelativeDateTransformer.xcodeproj/xcshareddata/xcschemes/SORelativeDateTransformer.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SORelativeDateTransformer/Info.plist b/SORelativeDateTransformer/Info.plist new file mode 100755 index 0000000..3d169df --- /dev/null +++ b/SORelativeDateTransformer/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + net.standardorbit.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index 31a9eb2..64677dc Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index b3b1e84..eb76e23 --- a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings +++ b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings @@ -14,8 +14,8 @@ "years" = "Jahren"; "month" = "Monat"; "months" = "Monaten"; -"week" = "Woche"; -"weeks" = "Wochen"; +"weekOfYear" = "Woche"; +"weekOfYears" = "Wochen"; "day" = "Tag"; "days" = "Tagen"; "hour" = "Stunde"; diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index 6d322d0..8ee28a9 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index adc68f6..c7601de Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index 7cf5515..952dffb Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index 82cb3df..dad09bf Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index b77c321..cc02ddc Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index 1ad5067..89b0380 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings index 428d1bd..0b91674 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index 9b4e2fa..0dcdf0a Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index debc10e..cade122 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings old mode 100644 new mode 100755 index 81b5cab..cc36bcf Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.h b/SORelativeDateTransformer/SORelativeDateTransformer.h old mode 100644 new mode 100755 index e838082..f3602a0 --- a/SORelativeDateTransformer/SORelativeDateTransformer.h +++ b/SORelativeDateTransformer/SORelativeDateTransformer.h @@ -27,12 +27,14 @@ #import +//! Project version number for SORelativeDateTransformer. +FOUNDATION_EXPORT double SORelativeDateTransformerVersionNumber; + +//! Project version string for SORelativeDateTransformer. +FOUNDATION_EXPORT const unsigned char SORelativeDateTransformerVersionString[]; + + @interface SORelativeDateTransformer : NSValueTransformer -{ - NSCalendar *__calendar; - NSUInteger __unitFlags; - NSArray *__dateComponentSelectorNames; -} /** @brief The cached instance of the value transformer registered with NSValueTransformer's global cache. @@ -49,4 +51,12 @@ */ - (id) transformedValue:(id)value; +/** + @brief Transform an NSDate into a phrase expressing the relative difference between that date and a reference date. + @param value An NSDate to be compared to the reference date. + @param referenceValue An NSDate to be used as a reference for obtaining the relative difference. + @return An NSString with the generated and localized phrase. + */ +- (id) transformedValue:(id)value referenceValue:(id)referenceValue; + @end diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.m b/SORelativeDateTransformer/SORelativeDateTransformer.m old mode 100644 new mode 100755 index fd031dd..56c7b49 --- a/SORelativeDateTransformer/SORelativeDateTransformer.m +++ b/SORelativeDateTransformer/SORelativeDateTransformer.m @@ -8,6 +8,15 @@ #import "SORelativeDateTransformer.h" +@interface SORelativeDateTransformer () +{ + NSCalendar *__calendar; + NSUInteger __unitFlags; + NSArray *__dateComponentSelectorNames; +} + +@end + @implementation SORelativeDateTransformer + (NSValueTransformer *) registeredTransformer @@ -19,7 +28,7 @@ + (NSBundle *)bundle { static NSBundle *bundle = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - NSURL *url = [[NSBundle mainBundle] URLForResource:@"SORelativeDateTransformer" withExtension:@"bundle"]; + NSURL *url = [[NSBundle bundleForClass:self] URLForResource:@"SORelativeDateTransformer" withExtension:@"bundle"]; bundle = [[NSBundle alloc] initWithURL:url]; }); return bundle; @@ -35,26 +44,13 @@ - (id) init if (!self) return nil; __calendar = [NSCalendar autoupdatingCurrentCalendar]; - -#if !__has_feature(objc_arc) - [__calendar retain]; -#endif - __unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSWeekCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; - __dateComponentSelectorNames = [[NSArray alloc] initWithObjects:@"year", @"month", @"week", @"day", @"hour", @"minute", @"second", nil]; + __unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitWeekOfYear | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; + __dateComponentSelectorNames = @[@"year", @"month", @"weekOfYear", @"day", @"hour", @"minute", @"second"]; return self; } -#if !__has_feature(objc_arc) -- (void) dealloc -{ - [__calendar release]; - [__dateComponentSelectorNames release]; - [super dealloc]; -} -#endif - #pragma mark - NSValueTransformer Overrides + (Class) transformedValueClass @@ -69,9 +65,14 @@ + (BOOL) allowsReverseTransformation } - (id) transformedValue:(id)value +{ + return [self transformedValue:value referenceValue:[NSDate date]]; +} + +- (id) transformedValue:(id)value referenceValue:(id)referenceValue { // Return early if input is whacked - if ([value isKindOfClass:[NSDate class]] == NO) { + if (![value isKindOfClass:[NSDate class]]) { return SORelativeDateLocalizedString(@"now", @"label for current date-time"); } @@ -79,7 +80,7 @@ - (id) transformedValue:(id)value // Obtain the date components for the relative difference between the input date and now. - NSDateComponents *relativeDifferenceComponents = [__calendar components:__unitFlags fromDate:value toDate:[NSDate date] options:0]; + NSDateComponents *relativeDifferenceComponents = [__calendar components:__unitFlags fromDate:value toDate:referenceValue options:0]; // Iterate the array of NSDateComponent selectors, which are sorted in decreasing order of time span: year, month, day, etc. // For the first NSDateComponent time span method that returns a reasonable non-zero value, use that value to compute the relative-to-now date phrase string. @@ -103,7 +104,8 @@ - (id) transformedValue:(id)value // If the relative difference between the input date and now is 0 for the date component named in this iteration, press on. // e.g. no difference between the month component of input date and now, continue iterating with the week component next to be evaluated. - if (relativeDifference == 0) continue; + if (relativeDifference == 0) + continue; // Lookup the localized name to use for the data component in our class' strings file. NSString *localizedDateComponentName = nil;