- Add library DJLocalizedString
- Add new function + (NSString*) stringMonth :(NSInteger) month - Add new function + (NSString*) stringFromWeekday :(NSInteger) weekday
This commit is contained in:
parent
5af3563ad7
commit
0e6697d60d
@ -302,9 +302,14 @@
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-NSDate_Utils_Example/Pods-NSDate_Utils_Example-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/DJLocalization/DJLocalization.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/NSDate_Utils/NSDate_Utils.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DJLocalization.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NSDate_Utils.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
@ -317,13 +322,16 @@
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-NSDate_Utils_Tests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
83D57E6020570D3087EF66CE /* [CP] Copy Pods Resources */ = {
|
||||
@ -362,13 +370,16 @@
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-NSDate_Utils_Example-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
B7E95ACD5604BD439932ECC8 /* [CP] Embed Pods Frameworks */ = {
|
||||
@ -377,9 +388,22 @@
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-NSDate_Utils_Tests/Pods-NSDate_Utils_Tests-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/DJLocalization/DJLocalization.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/NSDate_Utils/NSDate_Utils.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Expecta+Snapshots/Expecta_Snapshots.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Specta/Specta.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DJLocalization.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NSDate_Utils.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta_Snapshots.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSnapshotTestCase.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Specta.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
PODS:
|
||||
- Expecta (1.0.5)
|
||||
- DJLocalization (1.2.2):
|
||||
- DJLocalization/Core (= 1.2.2)
|
||||
- DJLocalization/Core (1.2.2)
|
||||
- Expecta (1.0.6)
|
||||
- Expecta+Snapshots (3.1.1):
|
||||
- Expecta (~> 1.0)
|
||||
- FBSnapshotTestCase/Core (~> 2.0)
|
||||
@ -9,7 +12,8 @@ PODS:
|
||||
- FBSnapshotTestCase/Core (2.1.4)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.1.4):
|
||||
- FBSnapshotTestCase/Core
|
||||
- NSDate_Utils (1.0.6)
|
||||
- NSDate_Utils (1.1.0):
|
||||
- DJLocalization
|
||||
- Specta (1.0.6)
|
||||
|
||||
DEPENDENCIES:
|
||||
@ -21,15 +25,16 @@ DEPENDENCIES:
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
NSDate_Utils:
|
||||
:path: "../"
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
||||
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
||||
Expecta+Snapshots: dcff217eef506dabd6dfdc7864ea2da321fafbb8
|
||||
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
|
||||
NSDate_Utils: c7802a1e0f5ef3acaf39bf55806a1caaa0343d2d
|
||||
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
|
||||
NSDate_Utils: c858a89da6e204ecf53aca48dbccb4da4d25bc9e
|
||||
Specta: f506f3a8361de16bc0dcf3b17b75e269072ba465
|
||||
|
||||
PODFILE CHECKSUM: 5d3cb6429ba8613bec51b3e797c0070e91be6b26
|
||||
|
||||
COCOAPODS: 1.2.0
|
||||
COCOAPODS: 1.3.1
|
||||
|
||||
13
Example/Pods/DJLocalization/DJLocalization/DJLocalizableString.h
generated
Executable file
13
Example/Pods/DJLocalization/DJLocalization/DJLocalizableString.h
generated
Executable file
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DJLocalizableString.h
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 15/02/15.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface DJLocalizableString : NSString
|
||||
|
||||
@end
|
||||
59
Example/Pods/DJLocalization/DJLocalization/DJLocalizableString.m
generated
Executable file
59
Example/Pods/DJLocalization/DJLocalization/DJLocalizableString.m
generated
Executable file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// DJLocalizableString.m
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 15/02/15.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DJLocalizableString.h"
|
||||
|
||||
#import "DJLocalizationSystem+Private.h"
|
||||
|
||||
static NSString * const kDJLocalizableString = @"NSLocalizableString";
|
||||
|
||||
@interface DJLocalizableString ()
|
||||
|
||||
@property (nonatomic, strong) NSString *developmentLanguageString;
|
||||
@property (nonatomic, strong) NSString *stringsFileKey;
|
||||
|
||||
@end
|
||||
|
||||
@implementation DJLocalizableString
|
||||
|
||||
+ (void)load {
|
||||
@autoreleasepool {
|
||||
[NSKeyedUnarchiver setClass: DJLocalizableString.class forClassName: kDJLocalizableString];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.stringsFileKey = [aDecoder decodeObjectForKey: @"NSKey"];
|
||||
self.developmentLanguageString = [aDecoder decodeObjectForKey: @"NSDev"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - NSObject
|
||||
|
||||
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder {
|
||||
return [DJLocalizationSystem.shared localizedStoryboardStringForKey: self.stringsFileKey
|
||||
value: self.developmentLanguageString];
|
||||
}
|
||||
|
||||
#pragma mark - NSString
|
||||
|
||||
- (NSUInteger)length {
|
||||
return self.developmentLanguageString.length;
|
||||
}
|
||||
|
||||
- (unichar)characterAtIndex:(NSUInteger)index {
|
||||
return [self.developmentLanguageString characterAtIndex: index];
|
||||
}
|
||||
|
||||
@end
|
||||
15
Example/Pods/DJLocalization/DJLocalization/DJLocalization.h
generated
Normal file
15
Example/Pods/DJLocalization/DJLocalization/DJLocalization.h
generated
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// DJLocalization.h
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 04/03/15.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef DJLocalization_h
|
||||
#define DJLocalization_h
|
||||
|
||||
#import "DJLocalizationSystem.h"
|
||||
#import "UIStoryboard+DJLocalization.h"
|
||||
|
||||
#endif
|
||||
23
Example/Pods/DJLocalization/DJLocalization/DJLocalizationSystem+Private.h
generated
Normal file
23
Example/Pods/DJLocalization/DJLocalization/DJLocalizationSystem+Private.h
generated
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// DJLocalizationSystem+Private.h
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 16/02/16.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DJLocalizationSystem.h"
|
||||
|
||||
@interface DJLocalizationSystem (Private)
|
||||
|
||||
/*!
|
||||
* Special version that tries to load a storyboard string from all the tables
|
||||
* except Localizable and InfoPlist. Defaults to comment if not found.
|
||||
*
|
||||
* @param key The localization key
|
||||
* @param comment The localization value
|
||||
* @return The localized string
|
||||
*/
|
||||
- (NSString *)localizedStoryboardStringForKey:(NSString *)key value:(NSString *)comment;
|
||||
|
||||
@end
|
||||
69
Example/Pods/DJLocalization/DJLocalization/DJLocalizationSystem.h
generated
Normal file
69
Example/Pods/DJLocalization/DJLocalization/DJLocalizationSystem.h
generated
Normal file
@ -0,0 +1,69 @@
|
||||
//
|
||||
// DJLocalizationSystem.h
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 15/02/15.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define DJLocalizedString(key, comment) \
|
||||
[DJLocalizationSystem.shared localizedStringForKey:(key) value: @"" table: nil]
|
||||
#define DJLocalizedStringFromTable(key, tbl, comment) \
|
||||
[DJLocalizationSystem.shared localizedStringForKey:(key) value: @"" table:(tbl)]
|
||||
|
||||
// replace Apple's macros with our own
|
||||
#undef NSLocalizedString
|
||||
#define NSLocalizedString(key, comment) \
|
||||
DJLocalizedString(key, comment)
|
||||
|
||||
#undef NSLocalizedStringFromTable
|
||||
#define NSLocalizedStringFromTable(key, tbl, comment) \
|
||||
DJLocalizedStringFromTable(key, tbl, comment)
|
||||
|
||||
@interface DJLocalizationSystem : NSObject
|
||||
|
||||
/*!
|
||||
* Get the system's global instance
|
||||
*
|
||||
* @return A localization system instance
|
||||
*/
|
||||
@property (class, nonnull, readonly) DJLocalizationSystem *shared;
|
||||
|
||||
/*!
|
||||
* Get the localized string for a given key/value
|
||||
*
|
||||
* @param key The localization key
|
||||
* @param comment The localization value
|
||||
* @param tableName The localization table name
|
||||
* @return The localized string
|
||||
*/
|
||||
- (nonnull NSString *)localizedStringForKey:(nullable NSString *)key value:(nullable NSString *)comment table:(nullable NSString *)tableName;
|
||||
|
||||
/*!
|
||||
* Get the localized string for a given key/value in the specified bundle
|
||||
*
|
||||
* @param key The localization key
|
||||
* @param comment The localization value
|
||||
* @param bundle The bundle to search in
|
||||
* @return The localized string
|
||||
*/
|
||||
- (nonnull NSString *)localizedStringForKey:(nullable NSString *)key value:(nullable NSString *)comment table:(nullable NSString *)tableName bundle:(nonnull NSBundle *)bundle;
|
||||
|
||||
/*!
|
||||
* Reset the localization to the system's default language
|
||||
*/
|
||||
- (void)resetLocalization;
|
||||
|
||||
/*!
|
||||
* The bundle for the currently active language
|
||||
*/
|
||||
@property (nonatomic, readonly, nonnull) NSBundle *bundle;
|
||||
|
||||
/*!
|
||||
* The currently active language
|
||||
*/
|
||||
@property (nonatomic, strong, nonnull) NSString *language;
|
||||
|
||||
@end
|
||||
136
Example/Pods/DJLocalization/DJLocalization/DJLocalizationSystem.m
generated
Normal file
136
Example/Pods/DJLocalization/DJLocalization/DJLocalizationSystem.m
generated
Normal file
@ -0,0 +1,136 @@
|
||||
//
|
||||
// DJLocalizationSystem.m
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 15/02/15.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DJLocalization.h"
|
||||
#import "DJLocalizationSystem+Private.h"
|
||||
|
||||
@interface DJLocalizationSystem ()
|
||||
|
||||
@property (nonatomic, strong) NSBundle *bundle;
|
||||
@property (nonatomic, strong) NSDictionary *storyboardStrings;
|
||||
@property (nonatomic, strong) NSString *customLanguage;
|
||||
|
||||
@end
|
||||
|
||||
@implementation DJLocalizationSystem
|
||||
|
||||
+ (instancetype)shared {
|
||||
__strong static DJLocalizationSystem *sharedSystem = nil;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedSystem = [self new];
|
||||
});
|
||||
|
||||
return sharedSystem;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (!self)
|
||||
return nil;
|
||||
|
||||
[self resetLocalization];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)localizedStoryboardStringForKey:(NSString *)key value:(NSString *)comment {
|
||||
NSString *result = self.storyboardStrings[key];
|
||||
if (!result)
|
||||
result = comment;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName {
|
||||
return [self.bundle localizedStringForKey: key value: value table: tableName];
|
||||
}
|
||||
|
||||
- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName bundle:(NSBundle *)bundle {
|
||||
// if no custom language, just get the standard localized string
|
||||
if (!self.customLanguage)
|
||||
return [bundle localizedStringForKey: key value: value table: tableName];
|
||||
|
||||
// check if our custom language exists
|
||||
NSString *path = [bundle pathForResource: self.customLanguage ofType: @"lproj"];
|
||||
if (path)
|
||||
return [[NSBundle bundleWithPath: path] localizedStringForKey: key value: value table: tableName];
|
||||
|
||||
// otherwise return the default
|
||||
return [bundle localizedStringForKey: key value: value table: tableName];
|
||||
}
|
||||
|
||||
- (void)resetLocalization {
|
||||
self.language = NSBundle.mainBundle.preferredLocalizations.firstObject;
|
||||
}
|
||||
|
||||
- (void)setLanguage:(NSString*)language {
|
||||
if ([language isEqualToString: self.customLanguage ])
|
||||
return;
|
||||
NSDictionary *languageInfo = [NSLocale componentsFromLocaleIdentifier: language];
|
||||
|
||||
// find bundle
|
||||
NSString *path = [NSBundle.mainBundle pathForResource: language ofType: @"lproj"];
|
||||
if (path == nil)
|
||||
path = [NSBundle.mainBundle pathForResource: languageInfo[NSLocaleLanguageCode] ofType: @"lproj"];
|
||||
|
||||
// set bundle
|
||||
if (path) {
|
||||
self.bundle = [NSBundle bundleWithPath: path];
|
||||
[self loadTables];
|
||||
|
||||
// store language id
|
||||
self.customLanguage = language;
|
||||
} else {
|
||||
NSLog(@"Localization error: no bundle found, resetting!");
|
||||
self.bundle = NSBundle.mainBundle;
|
||||
self.customLanguage = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString*)language {
|
||||
if (self.customLanguage)
|
||||
return self.customLanguage;
|
||||
else {
|
||||
NSString *language = NSLocale.preferredLanguages.firstObject;
|
||||
NSDictionary *languageInfo = [NSLocale componentsFromLocaleIdentifier: language];
|
||||
|
||||
return languageInfo[NSLocaleLanguageCode];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Helper methods
|
||||
|
||||
- (void)loadTables {
|
||||
NSMutableDictionary *strings = [NSMutableDictionary new];
|
||||
|
||||
// find strings files
|
||||
NSFileManager *fileManager = NSFileManager.defaultManager;
|
||||
NSURL *bundleURL = self.bundle.bundleURL;
|
||||
NSArray *contents = [fileManager contentsOfDirectoryAtURL: bundleURL
|
||||
includingPropertiesForKeys: @[]
|
||||
options: NSDirectoryEnumerationSkipsHiddenFiles
|
||||
error: nil];
|
||||
|
||||
// load them
|
||||
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"pathExtension == 'strings'"];
|
||||
for (NSURL *fileURL in [contents filteredArrayUsingPredicate: predicate]) {
|
||||
if ([fileURL.lastPathComponent isEqualToString: @"Localizable.strings"])
|
||||
continue;
|
||||
if ([fileURL.lastPathComponent isEqualToString: @"InfoPlist.strings"])
|
||||
continue;
|
||||
|
||||
NSDictionary *table = [NSDictionary dictionaryWithContentsOfURL: fileURL];
|
||||
[strings addEntriesFromDictionary: table];
|
||||
}
|
||||
|
||||
self.storyboardStrings = strings;
|
||||
}
|
||||
|
||||
@end
|
||||
21
Example/Pods/DJLocalization/DJLocalization/UIStoryboard+DJLocalization.h
generated
Normal file
21
Example/Pods/DJLocalization/DJLocalization/UIStoryboard+DJLocalization.h
generated
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// UIStoryboard+DJLocalization.h
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 15/02/15.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIStoryboard (DJLocalization)
|
||||
|
||||
/*!
|
||||
* Get the storyboard for the active language
|
||||
*
|
||||
* @param name The storyboard's name
|
||||
* @return The desired storyboard
|
||||
*/
|
||||
+ (nonnull instancetype)dj_storyboardWithName:(nonnull NSString *)name;
|
||||
|
||||
@end
|
||||
19
Example/Pods/DJLocalization/DJLocalization/UIStoryboard+DJLocalization.m
generated
Normal file
19
Example/Pods/DJLocalization/DJLocalization/UIStoryboard+DJLocalization.m
generated
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// UIStoryboard+DJLocalization.m
|
||||
// DJLocalization
|
||||
//
|
||||
// Created by David Jennes on 15/02/15.
|
||||
// Copyright (c) 2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIStoryboard+DJLocalization.h"
|
||||
|
||||
#import "DJLocalizationSystem.h"
|
||||
|
||||
@implementation UIStoryboard (DJLocalization)
|
||||
|
||||
+ (instancetype)dj_storyboardWithName:(NSString *)name {
|
||||
return [self storyboardWithName: name bundle: DJLocalizationSystem.shared.bundle];
|
||||
}
|
||||
|
||||
@end
|
||||
19
Example/Pods/DJLocalization/LICENSE
generated
Normal file
19
Example/Pods/DJLocalization/LICENSE
generated
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015 David Jennes <david.jennes@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
75
Example/Pods/DJLocalization/README.md
generated
Normal file
75
Example/Pods/DJLocalization/README.md
generated
Normal file
@ -0,0 +1,75 @@
|
||||
# DJLocalization
|
||||
|
||||
[](http://cocoadocs.org/docsets/DJLocalization)
|
||||
[](http://cocoadocs.org/docsets/DJLocalization)
|
||||
[](http://cocoadocs.org/docsets/DJLocalization)
|
||||
|
||||
Localization system that allows language switching at runtime. Supports both code strings (NSLocalizedString) and storyboards (base internationalization).
|
||||
|
||||
## Demo
|
||||
|
||||
To try the example project, just run the following command:
|
||||
|
||||
pod try DJLocalization
|
||||
|
||||
## Requirements
|
||||
|
||||
Requires iOS 6 or higher.
|
||||
|
||||
## Installation
|
||||
|
||||
### From CocoaPods
|
||||
|
||||
DJLocalization is available through [CocoaPods](http://cocoapods.org). To install
|
||||
it, simply add the following line to your Podfile:
|
||||
|
||||
pod "DJLocalization"
|
||||
|
||||
For Swift, use:
|
||||
|
||||
pod "DJLocalization/Swift"
|
||||
|
||||
|
||||
### Manually
|
||||
|
||||
_**Important note if your project doesn't use ARC**: you must add the `-fobjc-arc` compiler flag to all 'DJLocalization' files in Target Settings > Build Phases > Compile Sources._
|
||||
|
||||
* Drag the `DJLocalization/DJlocalization` folder into your project.
|
||||
|
||||
## Usage
|
||||
|
||||
### Importing headers
|
||||
|
||||
Then simply add the following import to your prefix header, or any file where you use the NSLocalizedString macro (or variants).
|
||||
|
||||
@import DJLocalization;
|
||||
|
||||
#####*Important:*
|
||||
You must import the header wherever you use the NSLocalizedString macro, as this header replaces the default NSLocalizedString macro with a custom one. If you don't, runtime switching of languages won't work.
|
||||
|
||||
### Localization
|
||||
|
||||
Use your normal localization workflow and everything should work correctly. For code strings use `NSLocalizedString`, for storyboards use Base Internationalization.
|
||||
|
||||
As mentioned before, `NSLocalizedString` will only work correctly if you first include the correct headers. If you want a bit more safety, the library provides some extra macros `DJLocalizedString` that provide the same functionality as the overridden `NSLocalizedString` macros. This way you'll get a compilation error if you forget to include the headers.
|
||||
|
||||
### Switching languages
|
||||
|
||||
At runtime, you can switch the language at any time by setting the language property:
|
||||
|
||||
[DJLocalizationSystem shared].language = @"en";
|
||||
|
||||
Be careful to only use language codes (en, nl, fr, etc...) for localizations that exist in your project.
|
||||
|
||||
#####*Important:*
|
||||
Views are translated on load. This means that if you switch the language at some point, only subsequently loaded views will have the correct language strings. Ideally, when you switch languages, you should pop your navigation controller to it's root view controller.
|
||||
|
||||
## Credits
|
||||
|
||||
DJLocalization is brought to you by [David Jennes](https://twitter.com/davidjennes). The code is inspired by [Rolandas Razma's](https://twitter.com/rolandas_razma) work with [RRBaseInternationalization](https://github.com/RolandasRazma/RRBaseInternationalization) (especially the way to load strings for storyboard/xib views).
|
||||
|
||||
Props to Rolandas Razma
|
||||
|
||||
## License
|
||||
|
||||
DJLocalization is available under the MIT license. See the LICENSE file for more info.
|
||||
8
Example/Pods/Expecta/Expecta/EXPDefines.h
generated
8
Example/Pods/Expecta/Expecta/EXPDefines.h
generated
@ -9,9 +9,9 @@
|
||||
#ifndef Expecta_EXPDefines_h
|
||||
#define Expecta_EXPDefines_h
|
||||
|
||||
typedef void (^EXPBasicBlock)();
|
||||
typedef id (^EXPIdBlock)();
|
||||
typedef BOOL (^EXPBoolBlock)();
|
||||
typedef NSString *(^EXPStringBlock)();
|
||||
typedef void (^EXPBasicBlock)(void);
|
||||
typedef id (^EXPIdBlock)(void);
|
||||
typedef BOOL (^EXPBoolBlock)(void);
|
||||
typedef NSString *(^EXPStringBlock)(void);
|
||||
|
||||
#endif
|
||||
|
||||
@ -4,12 +4,16 @@
|
||||
EXPMatcherImplementationBegin(respondTo, (SEL expected)) {
|
||||
BOOL actualIsNil = (actual == nil);
|
||||
BOOL expectedIsNull = (expected == NULL);
|
||||
|
||||
|
||||
prerequisite (^BOOL {
|
||||
return !(actualIsNil || expectedIsNull);
|
||||
});
|
||||
|
||||
match(^BOOL {
|
||||
if ([actual respondsToSelector:@selector(instancesRespondToSelector:)] &&
|
||||
[actual instancesRespondToSelector:expected]) {
|
||||
return YES;
|
||||
}
|
||||
return [actual respondsToSelector:expected];
|
||||
});
|
||||
|
||||
|
||||
140
Example/Pods/Expecta/README.md
generated
140
Example/Pods/Expecta/README.md
generated
@ -1,13 +1,8 @@
|
||||
#Expecta
|
||||
|
||||
[](https://travis-ci.org/specta/expecta)
|
||||
[](http://cocoadocs.org/docsets/Expecta/)
|
||||
[](http://cocoadocs.org/docsets/Expecta/)
|
||||
[](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
# Expecta [](https://travis-ci.org/specta/expecta) [](http://cocoadocs.org/docsets/Expecta/)
|
||||
|
||||
A matcher framework for Objective-C and Cocoa.
|
||||
|
||||
## Introduction
|
||||
## FEATURES
|
||||
|
||||
The main advantage of using Expecta over other matcher frameworks is that you do not have to specify the data types. Also, the syntax of Expecta matchers is much more readable and does not suffer from parenthesitis.
|
||||
|
||||
@ -18,63 +13,10 @@ expect([bar isBar]).to.equal(YES);
|
||||
expect(baz).to.equal(3.14159);
|
||||
```
|
||||
|
||||
Expecta is framework-agnostic: it works well with XCTest and XCTest-compatible test frameworks such as [Specta](http://github.com/petejkim/specta/).
|
||||
Expecta is framework-agnostic: it works well with XCTest and XCTest-compatible test frameworks such as [Specta](http://github.com/petejkim/specta/), or [Kiwi](https://github.com/kiwi-bdd/Kiwi/).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
You can setup Expecta using [Carthage](https://github.com/Carthage/Carthage), [CocoaPods](http://github.com/CocoaPods/CocoaPods) or [completely manually](#setting-up-manually).
|
||||
|
||||
### Carthage
|
||||
|
||||
1. Add Expecta to your project's `Cartfile.private`:
|
||||
|
||||
```ruby
|
||||
github "specta/expecta" "master"
|
||||
```
|
||||
|
||||
2. Run `carthage update` in your project directory.
|
||||
3. Drag the appropriate **Expecta.framework** for your platform (located in `Carthage/Build/`) into your application’s Xcode project, and add it to your test target(s).
|
||||
|
||||
### CocoaPods
|
||||
|
||||
1. Add Expecta to your project's `Podfile`:
|
||||
|
||||
```ruby
|
||||
target :MyApp do
|
||||
# Your app's dependencies
|
||||
end
|
||||
|
||||
target :MyAppTests do
|
||||
pod 'Expecta', '~> 1.0.0'
|
||||
end
|
||||
```
|
||||
|
||||
2. Run `pod update` or `pod install` in your project directory.
|
||||
|
||||
### Setting Up Manually
|
||||
|
||||
1. Clone Expecta from Github.
|
||||
2. Run `rake` in your project directory to build the frameworks and libraries.
|
||||
3. Add a Cocoa or Cocoa Touch Unit Testing Bundle target to your Xcode project if you don't already have one.
|
||||
4. For **OS X projects**, copy and add `Expecta.framework` in the `Products/osx` folder to your project's test target.
|
||||
|
||||
For **iOS projects**, copy and add `Expecta.framework` in the `Products/ios` folder to your project's test target.
|
||||
|
||||
You can also use `libExpecta.a` if you prefer to link Expecta as a static library — iOS 7.x and below require this.
|
||||
|
||||
6. Add `-ObjC` and `-all_load` to the **Other Linker Flags** build setting for the test target in your Xcode project.
|
||||
7. You can now use Expecta in your test classes by adding the following import:
|
||||
|
||||
```objective-c
|
||||
@import Expecta; // If you're using Expecta.framework
|
||||
|
||||
// OR
|
||||
|
||||
#import <Expecta/Expecta.h> // If you're using the static library, or the framework
|
||||
```
|
||||
|
||||
## Built-in Matchers
|
||||
## MATCHERS
|
||||
|
||||
> `expect(x).to.equal(y);` compares objects or primitives x and y and passes if they are identical (==) or equivalent isEqual:).
|
||||
|
||||
@ -132,13 +74,13 @@ You can setup Expecta using [Carthage](https://github.com/Carthage/Carthage), [C
|
||||
|
||||
> `expect(x).to.match(y);` passes if an instance of NSString `x` matches regular expression (given as NSString) `y` one or more times.
|
||||
|
||||
## Inverting Matchers
|
||||
### Inverting Matchers
|
||||
|
||||
Every matcher's criteria can be inverted by prepending `.notTo` or `.toNot`:
|
||||
|
||||
>`expect(x).notTo.equal(y);` compares objects or primitives x and y and passes if they are *not* equivalent.
|
||||
|
||||
## Asynchronous Testing
|
||||
### Asynchronous Testing
|
||||
|
||||
Every matcher can be made to perform asynchronous testing by prepending `.will`, `.willNot` or `after(...)`:
|
||||
|
||||
@ -172,14 +114,14 @@ describe(@"Foo", ^{
|
||||
});
|
||||
```
|
||||
|
||||
## Forced Failing
|
||||
### Forced Failing
|
||||
|
||||
You can fail a test by using the `failure` attribute. This can be used to test branching.
|
||||
|
||||
> `failure(@"This should not happen");` outright fails a test.
|
||||
|
||||
|
||||
## Writing New Matchers
|
||||
### WRITING NEW MATCHERS
|
||||
|
||||
Writing a new matcher is easy with special macros provided by Expecta. Take a look at how `.beKindOf()` matcher is defined:
|
||||
|
||||
@ -246,7 +188,7 @@ EXPMatcherImplementationBegin(beKindOf, (Class expected)) {
|
||||
EXPMatcherImplementationEnd
|
||||
```
|
||||
|
||||
## Dynamic Predicate Matchers
|
||||
## DYNAMIC PREDICATE MATCHERS
|
||||
|
||||
It is possible to add predicate matchers by simply defining the matcher interface, with the matcher implementation being handled at runtime by delegating to the predicate method on your object.
|
||||
|
||||
@ -282,6 +224,68 @@ You can now write your assertion as follows:
|
||||
expect(lightSwitch).isTurnedOn();
|
||||
```
|
||||
|
||||
## INSTALLATION
|
||||
|
||||
You can setup Expecta using [CocoaPods](http://github.com/CocoaPods/CocoaPods), [Carthage](https://github.com/Carthage/Carthage) or [completely manually](#setting-up-manually).
|
||||
|
||||
### CocoaPods
|
||||
|
||||
1. Add Expecta to your project's `Podfile`:
|
||||
|
||||
```ruby
|
||||
target :MyApp do
|
||||
# your app dependencies
|
||||
|
||||
target :MyAppTests do
|
||||
inherit! search_paths
|
||||
|
||||
pod 'Expecta', '~> 1.0'
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
### Carthage
|
||||
|
||||
1. Add Expecta to your project's `Cartfile.private`:
|
||||
|
||||
```ruby
|
||||
github "specta/expecta" "master"
|
||||
```
|
||||
|
||||
2. Run `carthage update` in your project directory.
|
||||
3. Drag the appropriate **Expecta.framework** for your platform (located in `Carthage/Build/`) into your application’s Xcode project, and add it to your test target(s).
|
||||
|
||||
|
||||
2. Run `pod update` or `pod install` in your project directory.
|
||||
|
||||
### Setting Up Manually
|
||||
|
||||
1. Clone Expecta from Github.
|
||||
2. Run `rake` in your project directory to build the frameworks and libraries.
|
||||
3. Add a Cocoa or Cocoa Touch Unit Testing Bundle target to your Xcode project if you don't already have one.
|
||||
4. For **OS X projects**, copy and add `Expecta.framework` in the `Products/osx` folder to your project's test target.
|
||||
|
||||
For **iOS projects**, copy and add `Expecta.framework` in the `Products/ios` folder to your project's test target.
|
||||
|
||||
You can also use `libExpecta.a` if you prefer to link Expecta as a static library — iOS 7.x and below require this.
|
||||
|
||||
6. Add `-ObjC` and `-all_load` to the **Other Linker Flags** build setting for the test target in your Xcode project.
|
||||
7. You can now use Expecta in your test classes by adding the following import:
|
||||
|
||||
```objective-c
|
||||
@import Expecta; // If you're using Expecta.framework
|
||||
|
||||
// OR
|
||||
|
||||
#import <Expecta/Expecta.h> // If you're using the static library, or the framework
|
||||
```
|
||||
|
||||
## STATUS
|
||||
|
||||
Expecta, and Specta are considered done projects, there are no plans for _active_ development on the project at the moment aside from ensuring future Xcode compatability.
|
||||
Therefore it is a stable dependency, but will not be moving into the Swift world. If you are looking for that, we recommend you consider [Quick](https://github.com/quick/quick) and [Nimble](https://github.com/quick/nimble).
|
||||
|
||||
|
||||
## Contribution Guidelines
|
||||
|
||||
* Please use only spaces and indent 2 spaces at a time.
|
||||
@ -290,4 +294,4 @@ expect(lightSwitch).isTurnedOn();
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2012-2015 [Specta Team](https://github.com/specta?tab=members). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).
|
||||
Copyright (c) 2012-2016 [Specta Team](https://github.com/specta?tab=members). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "NSDate_Utils",
|
||||
"version": "1.0.6",
|
||||
"version": "1.1.0",
|
||||
"summary": "NSDate_Utils is a NSDate category that helps date managements. For example NSString to NSDate, NSDate to NSString,NSSdate comparisons",
|
||||
"homepage": "https://github.com/giuseppenucifora/NSDate_Utils",
|
||||
"license": "MIT",
|
||||
@ -9,11 +9,16 @@
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/giuseppenucifora/NSDate_Utils.git",
|
||||
"tag": "1.0.6"
|
||||
"tag": "1.1.0"
|
||||
},
|
||||
"platforms": {
|
||||
"ios": "7.0"
|
||||
"ios": "8.0"
|
||||
},
|
||||
"requires_arc": true,
|
||||
"dependencies": {
|
||||
"DJLocalization": [
|
||||
|
||||
]
|
||||
},
|
||||
"source_files": "Pod/Classes/**/*"
|
||||
}
|
||||
|
||||
19
Example/Pods/Manifest.lock
generated
19
Example/Pods/Manifest.lock
generated
@ -1,5 +1,8 @@
|
||||
PODS:
|
||||
- Expecta (1.0.5)
|
||||
- DJLocalization (1.2.2):
|
||||
- DJLocalization/Core (= 1.2.2)
|
||||
- DJLocalization/Core (1.2.2)
|
||||
- Expecta (1.0.6)
|
||||
- Expecta+Snapshots (3.1.1):
|
||||
- Expecta (~> 1.0)
|
||||
- FBSnapshotTestCase/Core (~> 2.0)
|
||||
@ -9,7 +12,8 @@ PODS:
|
||||
- FBSnapshotTestCase/Core (2.1.4)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.1.4):
|
||||
- FBSnapshotTestCase/Core
|
||||
- NSDate_Utils (1.0.6)
|
||||
- NSDate_Utils (1.1.0):
|
||||
- DJLocalization
|
||||
- Specta (1.0.6)
|
||||
|
||||
DEPENDENCIES:
|
||||
@ -21,15 +25,16 @@ DEPENDENCIES:
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
NSDate_Utils:
|
||||
:path: "../"
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||
DJLocalization: 0c84029af375647d4104a42ae36be87194c46c47
|
||||
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
|
||||
Expecta+Snapshots: dcff217eef506dabd6dfdc7864ea2da321fafbb8
|
||||
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
|
||||
NSDate_Utils: c7802a1e0f5ef3acaf39bf55806a1caaa0343d2d
|
||||
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
|
||||
NSDate_Utils: c858a89da6e204ecf53aca48dbccb4da4d25bc9e
|
||||
Specta: f506f3a8361de16bc0dcf3b17b75e269072ba465
|
||||
|
||||
PODFILE CHECKSUM: 5d3cb6429ba8613bec51b3e797c0070e91be6b26
|
||||
|
||||
COCOAPODS: 1.2.0
|
||||
COCOAPODS: 1.3.1
|
||||
|
||||
2196
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
2196
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
5
Example/Pods/Target Support Files/DJLocalization/DJLocalization-dummy.m
generated
Normal file
5
Example/Pods/Target Support Files/DJLocalization/DJLocalization-dummy.m
generated
Normal file
@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_DJLocalization : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_DJLocalization
|
||||
@end
|
||||
12
Example/Pods/Target Support Files/DJLocalization/DJLocalization-prefix.pch
generated
Normal file
12
Example/Pods/Target Support Files/DJLocalization/DJLocalization-prefix.pch
generated
Normal file
@ -0,0 +1,12 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
20
Example/Pods/Target Support Files/DJLocalization/DJLocalization-umbrella.h
generated
Normal file
20
Example/Pods/Target Support Files/DJLocalization/DJLocalization-umbrella.h
generated
Normal file
@ -0,0 +1,20 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import "DJLocalizableString.h"
|
||||
#import "DJLocalization.h"
|
||||
#import "DJLocalizationSystem.h"
|
||||
#import "UIStoryboard+DJLocalization.h"
|
||||
|
||||
FOUNDATION_EXPORT double DJLocalizationVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char DJLocalizationVersionString[];
|
||||
|
||||
6
Example/Pods/Target Support Files/DJLocalization/DJLocalization.modulemap
generated
Normal file
6
Example/Pods/Target Support Files/DJLocalization/DJLocalization.modulemap
generated
Normal file
@ -0,0 +1,6 @@
|
||||
framework module DJLocalization {
|
||||
umbrella header "DJLocalization-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
10
Example/Pods/Target Support Files/DJLocalization/DJLocalization.xcconfig
generated
Normal file
10
Example/Pods/Target Support Files/DJLocalization/DJLocalization.xcconfig
generated
Normal file
@ -0,0 +1,10 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/DJLocalization
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
|
||||
OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/DJLocalization
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
26
Example/Pods/Target Support Files/DJLocalization/Info.plist
generated
Normal file
26
Example/Pods/Target Support Files/DJLocalization/Info.plist
generated
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.2.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.5</string>
|
||||
<string>1.0.6</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.6</string>
|
||||
<string>1.1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
|
||||
@ -1,6 +1,29 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## DJLocalization
|
||||
|
||||
Copyright (c) 2015 David Jennes <david.jennes@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## NSDate_Utils
|
||||
|
||||
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -12,6 +12,35 @@
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 David Jennes <david.jennes@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</string>
|
||||
<key>License</key>
|
||||
<string>MIT</string>
|
||||
<key>Title</key>
|
||||
<string>DJLocalization</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -6,6 +6,10 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
@ -23,9 +27,9 @@ install_framework()
|
||||
source="$(readlink "${source}")"
|
||||
fi
|
||||
|
||||
# use filter instead of exclude so missing patterns dont' throw errors
|
||||
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
# Use filter instead of exclude so missing patterns don't throw errors.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework "$1")"
|
||||
@ -54,6 +58,15 @@ install_framework()
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies the dSYM of a vendored framework
|
||||
install_dsym() {
|
||||
local source="$1"
|
||||
if [ -r "$source" ]; then
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Signs a framework with the provided identity
|
||||
code_sign_if_enabled() {
|
||||
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
||||
@ -76,7 +89,7 @@ strip_invalid_archs() {
|
||||
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
|
||||
stripped=""
|
||||
for arch in $archs; do
|
||||
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
|
||||
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
||||
stripped="$stripped $arch"
|
||||
@ -89,10 +102,12 @@ strip_invalid_archs() {
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/DJLocalization/DJLocalization.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/NSDate_Utils/NSDate_Utils.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/DJLocalization/DJLocalization.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/NSDate_Utils/NSDate_Utils.framework"
|
||||
fi
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
wait
|
||||
|
||||
@ -8,6 +8,10 @@ RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
||||
|
||||
XCASSET_FILES=()
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
case "${TARGETED_DEVICE_FAMILY}" in
|
||||
1,2)
|
||||
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
||||
@ -21,6 +25,9 @@ case "${TARGETED_DEVICE_FAMILY}" in
|
||||
3)
|
||||
TARGET_DEVICE_ARGS="--target-device tv"
|
||||
;;
|
||||
4)
|
||||
TARGET_DEVICE_ARGS="--target-device watch"
|
||||
;;
|
||||
*)
|
||||
TARGET_DEVICE_ARGS="--target-device mac"
|
||||
;;
|
||||
@ -41,29 +48,29 @@ EOM
|
||||
fi
|
||||
case $RESOURCE_PATH in
|
||||
*.storyboard)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
;;
|
||||
*.xib)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
;;
|
||||
*.framework)
|
||||
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
||||
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
;;
|
||||
*.xcdatamodel)
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
|
||||
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
|
||||
;;
|
||||
*.xcdatamodeld)
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
|
||||
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
|
||||
;;
|
||||
*.xcmappingmodel)
|
||||
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
|
||||
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
|
||||
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
|
||||
;;
|
||||
*.xcassets)
|
||||
@ -71,7 +78,7 @@ EOM
|
||||
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
|
||||
;;
|
||||
*)
|
||||
echo "$RESOURCE_PATH"
|
||||
echo "$RESOURCE_PATH" || true
|
||||
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "NSDate_Utils"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization/DJLocalization.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DJLocalization" -framework "NSDate_Utils"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "NSDate_Utils"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization/DJLocalization.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DJLocalization" -framework "NSDate_Utils"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,6 +1,29 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## DJLocalization
|
||||
|
||||
Copyright (c) 2015 David Jennes <david.jennes@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## NSDate_Utils
|
||||
|
||||
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -12,6 +12,35 @@
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 David Jennes <david.jennes@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</string>
|
||||
<key>License</key>
|
||||
<string>MIT</string>
|
||||
<key>Title</key>
|
||||
<string>DJLocalization</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -6,6 +6,10 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
@ -23,9 +27,9 @@ install_framework()
|
||||
source="$(readlink "${source}")"
|
||||
fi
|
||||
|
||||
# use filter instead of exclude so missing patterns dont' throw errors
|
||||
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
# Use filter instead of exclude so missing patterns don't throw errors.
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework "$1")"
|
||||
@ -54,6 +58,15 @@ install_framework()
|
||||
fi
|
||||
}
|
||||
|
||||
# Copies the dSYM of a vendored framework
|
||||
install_dsym() {
|
||||
local source="$1"
|
||||
if [ -r "$source" ]; then
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\""
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Signs a framework with the provided identity
|
||||
code_sign_if_enabled() {
|
||||
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
||||
@ -76,7 +89,7 @@ strip_invalid_archs() {
|
||||
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
|
||||
stripped=""
|
||||
for arch in $archs; do
|
||||
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
|
||||
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
||||
stripped="$stripped $arch"
|
||||
@ -89,18 +102,20 @@ strip_invalid_archs() {
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta/Expecta.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Specta/Specta.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/DJLocalization/DJLocalization.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Specta/Specta.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta/Expecta.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Specta/Specta.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/DJLocalization/DJLocalization.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "${BUILT_PRODUCTS_DIR}/Specta/Specta.framework"
|
||||
fi
|
||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||
wait
|
||||
|
||||
@ -8,6 +8,10 @@ RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
||||
|
||||
XCASSET_FILES=()
|
||||
|
||||
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||
|
||||
case "${TARGETED_DEVICE_FAMILY}" in
|
||||
1,2)
|
||||
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
||||
@ -21,6 +25,9 @@ case "${TARGETED_DEVICE_FAMILY}" in
|
||||
3)
|
||||
TARGET_DEVICE_ARGS="--target-device tv"
|
||||
;;
|
||||
4)
|
||||
TARGET_DEVICE_ARGS="--target-device watch"
|
||||
;;
|
||||
*)
|
||||
TARGET_DEVICE_ARGS="--target-device mac"
|
||||
;;
|
||||
@ -41,29 +48,29 @@ EOM
|
||||
fi
|
||||
case $RESOURCE_PATH in
|
||||
*.storyboard)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
;;
|
||||
*.xib)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||
;;
|
||||
*.framework)
|
||||
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
||||
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
||||
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
;;
|
||||
*.xcdatamodel)
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
|
||||
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
|
||||
;;
|
||||
*.xcdatamodeld)
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
|
||||
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
|
||||
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
|
||||
;;
|
||||
*.xcmappingmodel)
|
||||
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
|
||||
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
|
||||
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
|
||||
;;
|
||||
*.xcassets)
|
||||
@ -71,7 +78,7 @@ EOM
|
||||
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
|
||||
;;
|
||||
*)
|
||||
echo "$RESOURCE_PATH"
|
||||
echo "$RESOURCE_PATH" || true
|
||||
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$PODS_CONFIGURATION_BUILD_DIR/Expecta" "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/Specta"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/Expecta" "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/Specta"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "Specta"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization/DJLocalization.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DJLocalization" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "Specta"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$PODS_CONFIGURATION_BUILD_DIR/Expecta" "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/Specta"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization" "$PODS_CONFIGURATION_BUILD_DIR/Expecta" "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils" "$PODS_CONFIGURATION_BUILD_DIR/Specta"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "Specta"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/DJLocalization/DJLocalization.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DJLocalization" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "Specta"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_BUILD_DIR = $BUILD_DIR
|
||||
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "NSDate_Utils"
|
||||
s.version = "1.0.6"
|
||||
s.version = "1.1.0"
|
||||
s.summary = "NSDate_Utils is a NSDate category that helps date managements. For example NSString to NSDate, NSDate to NSString,NSSdate comparisons"
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
@ -25,9 +25,10 @@ s.summary = "NSDate_Utils is a NSDate category that helps date manageme
|
||||
s.source = { :git => "https://github.com/giuseppenucifora/NSDate_Utils.git", :tag => s.version.to_s }
|
||||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
|
||||
|
||||
s.platform = :ios, '7.0'
|
||||
s.platform = :ios, '8.0'
|
||||
s.requires_arc = true
|
||||
|
||||
s.dependency 'DJLocalization'
|
||||
s.source_files = 'Pod/Classes/**/*'
|
||||
|
||||
end
|
||||
|
||||
@ -94,6 +94,9 @@ static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparat
|
||||
+ (NSTimeInterval) timeIntervalFromMinutes:(NSUInteger) minutes;
|
||||
+ (NSTimeInterval) timeIntervalFromHours:(NSUInteger) minutes;
|
||||
|
||||
+ (NSString * _Nonnull) stringFromWeekday :(NSInteger) weekday;
|
||||
+ (NSString * _Nonnull) stringMonth :(NSInteger) month;
|
||||
|
||||
- (NSDate * _Nonnull) dateToNearestMinutes:(NSInteger)minutes;
|
||||
|
||||
- (NSDate * _Nonnull) dateByAddingMinutes:(NSInteger) dMinutes;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
#import "NSDate+NSDate_Util.h"
|
||||
#import <DJLocalization/DJLocalizationSystem.h>
|
||||
|
||||
#define DATE_COMPONENTS (NSCalendarUnitEra | NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekOfMonth | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond | NSCalendarUnitWeekday | NSCalendarUnitWeekdayOrdinal)
|
||||
#define CURRENT_CALENDAR [NSCalendar currentCalendar]
|
||||
@ -263,45 +264,45 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
|
||||
if (time < 60) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Poco fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Poco fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Poco fa", nil);
|
||||
return DJLocalizedString(@"Poco fa", nil);
|
||||
} else if (time < 3600) {
|
||||
int diff = round(time / 60);
|
||||
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"1 Minuto fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"1 Minuto fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"1 Minuto fa", nil);
|
||||
return DJLocalizedString(@"1 Minuto fa", nil);
|
||||
}
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Minuti fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Minuti fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Minuti fa", nil)];
|
||||
return [NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Minuti fa", nil)];
|
||||
|
||||
} else if (time < 86400) {
|
||||
int diff = round(time / 60 / 60);
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"1 Ora fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"1 Ora fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"1 Ora fa", nil);
|
||||
return DJLocalizedString(@"1 Ora fa", nil);
|
||||
}
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Ore fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Ore fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Ore fa", nil)];
|
||||
return [NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Ore fa", nil)];
|
||||
} else {
|
||||
NSInteger diff = round(time / 60 / 60 / 24);
|
||||
switch (diff) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
|
||||
return [[NSString stringWithFormat:@"%@",NSLocalizedString(@"Ieri", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%@",DJLocalizedString(@"Ieri", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%@",NSLocalizedString(@"Ieri", nil)];
|
||||
return [NSString stringWithFormat:@"%@",DJLocalizedString(@"Ieri", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -311,9 +312,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 6: {
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@", (long)diff, NSLocalizedString(@"Giorni fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@", (long)diff, DJLocalizedString(@"Giorni fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@", (long)diff, NSLocalizedString(@"Giorni fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@", (long)diff, DJLocalizedString(@"Giorni fa", nil)];
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
@ -321,26 +322,26 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffWeeks) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimana fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimana fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimana fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimana fa", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimane fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimane fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimane fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimane fa", nil)];
|
||||
break;
|
||||
default:{
|
||||
NSInteger diffMounth = round(time / 60 /60 / 24 / 30);
|
||||
switch (diffMounth) {
|
||||
case 1: {
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mese fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mese fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mese fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mese fa", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -354,9 +355,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 10:
|
||||
case 11:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mesi fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mesi fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mesi fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mesi fa", nil)];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -365,15 +366,15 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffYears) {
|
||||
case 1:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anno fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anno fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anno fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anno fa", nil)];
|
||||
break;
|
||||
default:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anni fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anni fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anni fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anni fa", nil)];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -391,45 +392,45 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
else {
|
||||
if (time < 60) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Tra poco", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Tra poco", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Tra poco", nil);
|
||||
return DJLocalizedString(@"Tra poco", nil);
|
||||
} else if (time < 3600) {
|
||||
int diff = round(time / 60);
|
||||
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Tra 1 minuto", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Tra 1 minuto", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Tra 1 minuto", nil);
|
||||
return DJLocalizedString(@"Tra 1 minuto", nil);
|
||||
}
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d minuti", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d minuti", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d minuti", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d minuti", nil), diff];
|
||||
|
||||
} else if (time < 86400) {
|
||||
int diff = round(time / 60 / 60);
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Tra 1 ora", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Tra 1 ora", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Tra 1 ora", nil);
|
||||
return DJLocalizedString(@"Tra 1 ora", nil);
|
||||
}
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d ore", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d ore", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d ore", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d ore", nil), diff];
|
||||
} else {
|
||||
NSInteger diff = round(time / 60 / 60 / 24);
|
||||
switch (diff) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
|
||||
return [[NSString stringWithFormat:@"%@",NSLocalizedString(@"Domani", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%@",DJLocalizedString(@"Domani", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%@",NSLocalizedString(@"Domani", nil)];
|
||||
return [NSString stringWithFormat:@"%@",DJLocalizedString(@"Domani", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -439,9 +440,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 6: {
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d giorni", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d giorni", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d giorni", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d giorni", nil), diff];
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
@ -449,26 +450,26 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffWeeks) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Tra 1 Settimana", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Tra 1 Settimana", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Tra 1 Settimana", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Tra 1 Settimana", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d settimane", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d settimane", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d settimane", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d settimane", nil), diff];
|
||||
break;
|
||||
default:{
|
||||
NSInteger diffMounth = round(time / 60 /60 / 24 / 30);
|
||||
switch (diffMounth) {
|
||||
case 1: {
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d mese", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d mese", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d mese", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d mese", nil), diff];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -482,9 +483,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 10:
|
||||
case 11:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d mesi", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d mesi", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d mesi", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d mesi", nil), diff];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -493,15 +494,15 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffYears) {
|
||||
case 1:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d anno", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d anno", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d anno", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d anno", nil), diff];
|
||||
break;
|
||||
default:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d anni", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d anni", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d anni", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d anni", nil), diff];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -721,10 +722,10 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
NSString *text = nil;
|
||||
switch (daysAgo) {
|
||||
case 0:
|
||||
text = NSLocalizedString(@"Today", nil);
|
||||
text = DJLocalizedString(@"Today", nil);
|
||||
break;
|
||||
case 1:
|
||||
text = NSLocalizedString(@"Yesterday", nil);
|
||||
text = DJLocalizedString(@"Yesterday", nil);
|
||||
break;
|
||||
default:
|
||||
text = [NSString stringWithFormat:@"%ld days ago", (long)daysAgo];
|
||||
@ -881,45 +882,45 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
|
||||
if (time < 60) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Poco fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Poco fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Poco fa", nil);
|
||||
return DJLocalizedString(@"Poco fa", nil);
|
||||
} else if (time < 3600) {
|
||||
int diff = round(time / 60);
|
||||
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"1 Minuto fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"1 Minuto fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"1 Minuto fa", nil);
|
||||
return DJLocalizedString(@"1 Minuto fa", nil);
|
||||
}
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Minuti fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Minuti fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Minuti fa", nil)];
|
||||
return [NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Minuti fa", nil)];
|
||||
|
||||
} else if (time < 86400) {
|
||||
int diff = round(time / 60 / 60);
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"1 Ora fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"1 Ora fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"1 Ora fa", nil);
|
||||
return DJLocalizedString(@"1 Ora fa", nil);
|
||||
}
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Ore fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Ore fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Ore fa", nil)];
|
||||
return [NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Ore fa", nil)];
|
||||
} else {
|
||||
NSInteger diff = round(time / 60 / 60 / 24);
|
||||
switch (diff) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
|
||||
return [[NSString stringWithFormat:@"%@",NSLocalizedString(@"Ieri", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%@",DJLocalizedString(@"Ieri", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%@",NSLocalizedString(@"Ieri", nil)];
|
||||
return [NSString stringWithFormat:@"%@",DJLocalizedString(@"Ieri", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -929,9 +930,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 6: {
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@", (long)diff, NSLocalizedString(@"Giorni fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@", (long)diff, DJLocalizedString(@"Giorni fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@", (long)diff, NSLocalizedString(@"Giorni fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@", (long)diff, DJLocalizedString(@"Giorni fa", nil)];
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
@ -939,26 +940,26 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffWeeks) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimana fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimana fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimana fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimana fa", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimane fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimane fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Settimane fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Settimane fa", nil)];
|
||||
break;
|
||||
default:{
|
||||
NSInteger diffMounth = round(time / 60 /60 / 24 / 30);
|
||||
switch (diffMounth) {
|
||||
case 1: {
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mese fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mese fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mese fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mese fa", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -972,9 +973,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 10:
|
||||
case 11:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mesi fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mesi fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,NSLocalizedString(@"Mesi fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffMounth,DJLocalizedString(@"Mesi fa", nil)];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -983,15 +984,15 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffYears) {
|
||||
case 1:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anno fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anno fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anno fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anno fa", nil)];
|
||||
break;
|
||||
default:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anni fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anni fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,NSLocalizedString(@"Anni fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffYears,DJLocalizedString(@"Anni fa", nil)];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1009,45 +1010,45 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
else {
|
||||
if (time < 60) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Tra poco", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Tra poco", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Tra poco", nil);
|
||||
return DJLocalizedString(@"Tra poco", nil);
|
||||
} else if (time < 3600) {
|
||||
int diff = round(time / 60);
|
||||
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Tra 1 minuto", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Tra 1 minuto", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Tra 1 minuto", nil);
|
||||
return DJLocalizedString(@"Tra 1 minuto", nil);
|
||||
}
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d minuti", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d minuti", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d minuti", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d minuti", nil), diff];
|
||||
|
||||
} else if (time < 86400) {
|
||||
int diff = round(time / 60 / 60);
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Tra 1 ora", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Tra 1 ora", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Tra 1 ora", nil);
|
||||
return DJLocalizedString(@"Tra 1 ora", nil);
|
||||
}
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d ore", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d ore", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d ore", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d ore", nil), diff];
|
||||
} else {
|
||||
NSInteger diff = round(time / 60 / 60 / 24);
|
||||
switch (diff) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
|
||||
return [[NSString stringWithFormat:@"%@",NSLocalizedString(@"Domani", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%@",DJLocalizedString(@"Domani", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%@",NSLocalizedString(@"Domani", nil)];
|
||||
return [NSString stringWithFormat:@"%@",DJLocalizedString(@"Domani", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -1057,9 +1058,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 6: {
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d giorni", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d giorni", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d giorni", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d giorni", nil), diff];
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
@ -1067,26 +1068,26 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffWeeks) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Tra 1 Settimana", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Tra 1 Settimana", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,NSLocalizedString(@"Tra 1 Settimana", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@",(long)diffWeeks,DJLocalizedString(@"Tra 1 Settimana", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d settimane", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d settimane", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d settimane", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d settimane", nil), diff];
|
||||
break;
|
||||
default:{
|
||||
NSInteger diffMounth = round(time / 60 /60 / 24 / 30);
|
||||
switch (diffMounth) {
|
||||
case 1: {
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d mese", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d mese", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d mese", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d mese", nil), diff];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -1100,9 +1101,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 10:
|
||||
case 11:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d mesi", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d mesi", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d mesi", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d mesi", nil), diff];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1111,15 +1112,15 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
switch (diffYears) {
|
||||
case 1:
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d anno", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d anno", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d anno", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d anno", nil), diff];
|
||||
break;
|
||||
default:{
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:NSLocalizedString(@"Tra %d anni", nil), diff] uppercaseString];
|
||||
return [[NSString stringWithFormat:DJLocalizedString(@"Tra %d anni", nil), diff] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Tra %d anni", nil), diff];
|
||||
return [NSString stringWithFormat:DJLocalizedString(@"Tra %d anni", nil), diff];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1146,45 +1147,45 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
|
||||
if (time < 60) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"Poco fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"Poco fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"Poco fa", nil);
|
||||
return DJLocalizedString(@"Poco fa", nil);
|
||||
} else if (time < 3600) {
|
||||
int diff = round(time / 60);
|
||||
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"1 Minuto fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"1 Minuto fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"1 Minuto fa", nil);
|
||||
return DJLocalizedString(@"1 Minuto fa", nil);
|
||||
}
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Minuti fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Minuti fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Minuti fa", nil)];
|
||||
return [NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Minuti fa", nil)];
|
||||
|
||||
} else if (time < 86400) {
|
||||
int diff = round(time / 60 / 60);
|
||||
if (diff == 1) {
|
||||
if (uppercaseString) {
|
||||
return [NSLocalizedString(@"1 Ora fa", nil) uppercaseString];
|
||||
return [DJLocalizedString(@"1 Ora fa", nil) uppercaseString];
|
||||
}
|
||||
return NSLocalizedString(@"1 Ora fa", nil);
|
||||
return DJLocalizedString(@"1 Ora fa", nil);
|
||||
}
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Ore fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Ore fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%d %@", diff, NSLocalizedString(@"Ore fa", nil)];
|
||||
return [NSString stringWithFormat:@"%d %@", diff, DJLocalizedString(@"Ore fa", nil)];
|
||||
} else {
|
||||
NSInteger diff = round(time / 60 / 60 / 24);
|
||||
switch (diff) {
|
||||
case 1:{
|
||||
if (uppercaseString) {
|
||||
|
||||
return [[NSString stringWithFormat:@"%@",NSLocalizedString(@"Ieri", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%@",DJLocalizedString(@"Ieri", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%@",NSLocalizedString(@"Ieri", nil)];
|
||||
return [NSString stringWithFormat:@"%@",DJLocalizedString(@"Ieri", nil)];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -1194,9 +1195,9 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
case 6: {
|
||||
|
||||
if (uppercaseString) {
|
||||
return [[NSString stringWithFormat:@"%ld %@", (long)diff, NSLocalizedString(@"Giorni fa", nil)] uppercaseString];
|
||||
return [[NSString stringWithFormat:@"%ld %@", (long)diff, DJLocalizedString(@"Giorni fa", nil)] uppercaseString];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%ld %@", (long)diff, NSLocalizedString(@"Giorni fa", nil)];
|
||||
return [NSString stringWithFormat:@"%ld %@", (long)diff, DJLocalizedString(@"Giorni fa", nil)];
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
@ -1213,4 +1214,39 @@ static NSDateFormatter *_displayFormatter = nil;
|
||||
}
|
||||
return @"";
|
||||
}
|
||||
|
||||
+ (NSString*) stringFromWeekday :(NSInteger) weekday
|
||||
{
|
||||
NSString *strings[] = {
|
||||
DJLocalizedString(@"Sunday", @""),
|
||||
DJLocalizedString(@"Monday", @""),
|
||||
DJLocalizedString(@"Tuesday", @""),
|
||||
DJLocalizedString(@"Wednesday", @""),
|
||||
DJLocalizedString(@"Thursday", @""),
|
||||
DJLocalizedString(@"Friday", @""),
|
||||
DJLocalizedString(@"Saturday", @""),
|
||||
};
|
||||
|
||||
return strings[weekday-1];
|
||||
}
|
||||
|
||||
+ (NSString*) stringMonth :(NSInteger) month;
|
||||
{
|
||||
NSString *strings[] = {
|
||||
DJLocalizedString(@"January", @""),
|
||||
DJLocalizedString(@"February", @""),
|
||||
DJLocalizedString(@"March", @""),
|
||||
DJLocalizedString(@"April", @""),
|
||||
DJLocalizedString(@"May", @""),
|
||||
DJLocalizedString(@"June", @""),
|
||||
DJLocalizedString(@"July", @""),
|
||||
DJLocalizedString(@"August", @""),
|
||||
DJLocalizedString(@"September", @""),
|
||||
DJLocalizedString(@"October", @""),
|
||||
DJLocalizedString(@"November", @""),
|
||||
DJLocalizedString(@"December", @""),
|
||||
};
|
||||
|
||||
return strings[month-1];
|
||||
}
|
||||
@end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user