Skip to content

Commit f99444c

Browse files
author
Shan Ul Haq
committed
added support for custom date formatter
1 parent 4e9364b commit f99444c

File tree

5 files changed

+362
-109
lines changed

5 files changed

+362
-109
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0620"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "F2B4092C18BA16F400611B29"
18+
BuildableName = "SHModelObject.app"
19+
BlueprintName = "SHModelObject"
20+
ReferencedContainer = "container:SHModelObject.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "F2B4094718BA16F500611B29"
32+
BuildableName = "SHModelObjectTests.xctest"
33+
BlueprintName = "SHModelObjectTests"
34+
ReferencedContainer = "container:SHModelObject.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
</BuildActionEntries>
38+
</BuildAction>
39+
<TestAction
40+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42+
shouldUseLaunchSchemeArgsEnv = "YES"
43+
buildConfiguration = "Debug">
44+
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "F2B4094718BA16F500611B29"
50+
BuildableName = "SHModelObjectTests.xctest"
51+
BlueprintName = "SHModelObjectTests"
52+
ReferencedContainer = "container:SHModelObject.xcodeproj">
53+
</BuildableReference>
54+
</TestableReference>
55+
</Testables>
56+
<MacroExpansion>
57+
<BuildableReference
58+
BuildableIdentifier = "primary"
59+
BlueprintIdentifier = "F2B4092C18BA16F400611B29"
60+
BuildableName = "SHModelObject.app"
61+
BlueprintName = "SHModelObject"
62+
ReferencedContainer = "container:SHModelObject.xcodeproj">
63+
</BuildableReference>
64+
</MacroExpansion>
65+
</TestAction>
66+
<LaunchAction
67+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
68+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
69+
launchStyle = "0"
70+
useCustomWorkingDirectory = "NO"
71+
buildConfiguration = "Debug"
72+
ignoresPersistentStateOnLaunch = "NO"
73+
debugDocumentVersioning = "YES"
74+
allowLocationSimulation = "YES">
75+
<BuildableProductRunnable
76+
runnableDebuggingMode = "0">
77+
<BuildableReference
78+
BuildableIdentifier = "primary"
79+
BlueprintIdentifier = "F2B4092C18BA16F400611B29"
80+
BuildableName = "SHModelObject.app"
81+
BlueprintName = "SHModelObject"
82+
ReferencedContainer = "container:SHModelObject.xcodeproj">
83+
</BuildableReference>
84+
</BuildableProductRunnable>
85+
<AdditionalOptions>
86+
</AdditionalOptions>
87+
</LaunchAction>
88+
<ProfileAction
89+
shouldUseLaunchSchemeArgsEnv = "YES"
90+
savedToolIdentifier = ""
91+
useCustomWorkingDirectory = "NO"
92+
buildConfiguration = "Release"
93+
debugDocumentVersioning = "YES">
94+
<BuildableProductRunnable
95+
runnableDebuggingMode = "0">
96+
<BuildableReference
97+
BuildableIdentifier = "primary"
98+
BlueprintIdentifier = "F2B4092C18BA16F400611B29"
99+
BuildableName = "SHModelObject.app"
100+
BlueprintName = "SHModelObject"
101+
ReferencedContainer = "container:SHModelObject.xcodeproj">
102+
</BuildableReference>
103+
</BuildableProductRunnable>
104+
</ProfileAction>
105+
<AnalyzeAction
106+
buildConfiguration = "Debug">
107+
</AnalyzeAction>
108+
<ArchiveAction
109+
buildConfiguration = "Release"
110+
revealArchiveInOrganizer = "YES">
111+
</ArchiveAction>
112+
</Scheme>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>SHModelObject.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>F2B4092C18BA16F400611B29</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>F2B4094718BA16F500611B29</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
</dict>
26+
</dict>
27+
</plist>

SHModelObject/SHModelObject/SHModelObject.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@
5555
inputDateType:(kInputDateFormat)inputDateType
5656
mappings:(NSDictionary *)mapping;
5757

58+
/**
59+
* class initializer
60+
*
61+
* @param dictionary dictionary containing key/value pairs for the object
62+
* @param option `kDateConverstionOption` to determine what to do when the value from dictionary is a DOT.NET Date
63+
*type.
64+
* @param inputDateFormat NSDateFormatter format specifier which will be used to format the input date.
65+
* @param mapping dictionary to define the mappings for date conversion and array <-> object.
66+
*
67+
* @return object of type instancetype populated with the values from `dictionary`
68+
*/
69+
- (instancetype)initWithDictionary:(NSDictionary *)dictionary
70+
dateConversionOption:(kDateConversionOption)option
71+
inputDateFormat:(NSString *)inputDateFormat
72+
mappings:(NSDictionary *)mapping;
73+
5874
/**
5975
* static variant of class initializer with nil check for the dictionary passed
6076
*
@@ -92,6 +108,22 @@
92108
inputDateType:(kInputDateFormat)inputDateType
93109
mappings:(NSDictionary *)mapping;
94110

111+
/**
112+
* static variant of class initializer with nil check for the dictionary passed
113+
*
114+
* @param dictionary dictionary containing key/value pairs for the object
115+
* @param option `kDateConverstionOption` to determine what to do when the value from dictionary is a DOT.NET Date
116+
*type.
117+
* @param inputDateFormat NSDateFormatter format specifier which will be used to format the input date.
118+
* @param mapping dictionary to define the mappings for date conversion and array <-> object.
119+
*
120+
* @return object of type instancetype populated with the values from `dictionary`
121+
*/
122+
+ (instancetype)objectWithDictionary:(NSDictionary *)dictionary
123+
dateConversionOption:(kDateConversionOption)option
124+
inputDateFormat:(NSString *)inputDateFormat
125+
mappings:(NSDictionary *)mapping;
126+
95127
/**
96128
* update the instance with new dictionary values
97129
*
@@ -116,6 +148,23 @@
116148
dateConversionOption:(kDateConversionOption)option
117149
inputDateType:(kInputDateFormat)inputDateType
118150
mappings:(NSDictionary *)mapping;
151+
152+
/**
153+
* update the instance with new dictionary values
154+
*
155+
* @param dictionary dictionary containing key/value pairs for the object
156+
* @param option `kDateConverstionOption` to determine what to do when the value from dictionary is a DOT.NET Date
157+
*type.
158+
* @param inputDateFormat NSDateFormatter format specifier which will be used to format the input date.
159+
* @param mapping dictionary to define the mappings for date conversion and array <-> object.
160+
*
161+
* @return object of type instancetype populated with the values from `dictionary`
162+
*/
163+
- (instancetype)updateWithDictionary:(NSDictionary *)dictionary
164+
dateConversionOption:(kDateConversionOption)option
165+
inputDateFormat:(NSString *)inputDateFormat
166+
mappings:(NSDictionary *)mapping;
167+
119168
@end
120169

121170
@interface NSString (Additions)

0 commit comments

Comments
 (0)