diff --git a/Marshmallows.xcodeproj/project.pbxproj b/Marshmallows.xcodeproj/project.pbxproj index e087f32..78c0f33 100644 --- a/Marshmallows.xcodeproj/project.pbxproj +++ b/Marshmallows.xcodeproj/project.pbxproj @@ -8,16 +8,17 @@ /* Begin PBXBuildFile section */ 7B13A56E1415CE360033DCC2 /* libMarshmallows.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BE32D0614132EE4008F2DEA /* libMarshmallows.a */; }; - 7B2C8D7614159642004E1123 /* UIAlertView+simple.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B2C8D7414159642004E1123 /* UIAlertView+simple.h */; }; - 7B2C8D7714159642004E1123 /* UIAlertView+simple.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B2C8D7514159642004E1123 /* UIAlertView+simple.m */; }; + 7B13A5711415FD2D0033DCC2 /* MMHTTPRequestTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B13A5701415FD2D0033DCC2 /* MMHTTPRequestTest.m */; }; + 7B2C8D7614159642004E1123 /* UIAlertView+marshmallows.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B2C8D7414159642004E1123 /* UIAlertView+marshmallows.h */; }; + 7B2C8D7714159642004E1123 /* UIAlertView+marshmallows.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B2C8D7514159642004E1123 /* UIAlertView+marshmallows.m */; }; 7B2C8D811415C450004E1123 /* UIAlertViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B2C8D7F1415C450004E1123 /* UIAlertViewDelegate.h */; }; 7B2C8D821415C450004E1123 /* UIAlertViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B2C8D801415C450004E1123 /* UIAlertViewDelegate.m */; }; 7BD100A2141341EB00A9921B /* MMHTTPClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BD100A0141341EB00A9921B /* MMHTTPClient.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7BD100A3141341EB00A9921B /* MMHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD100A1141341EB00A9921B /* MMHTTPClient.m */; }; 7BD100A614134FBE00A9921B /* MMHTTPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BD100A414134FBE00A9921B /* MMHTTPRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7BD100A714134FBE00A9921B /* MMHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD100A514134FBE00A9921B /* MMHTTPRequest.m */; }; - 7BD100AA141353B700A9921B /* NSDate+relative.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BD100A8141353B700A9921B /* NSDate+relative.h */; }; - 7BD100AB141353B700A9921B /* NSDate+relative.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD100A9141353B700A9921B /* NSDate+relative.m */; }; + 7BD100AA141353B700A9921B /* NSDate+marshmallows.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BD100A8141353B700A9921B /* NSDate+marshmallows.h */; }; + 7BD100AB141353B700A9921B /* NSDate+marshmallows.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD100A9141353B700A9921B /* NSDate+marshmallows.m */; }; 7BD100AC141364A900A9921B /* Marshmallows.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BE32D0E14132EE4008F2DEA /* Marshmallows.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7BD100D714136F7500A9921B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BD100B61413675100A9921B /* UIKit.framework */; }; 7BD100D814136F7500A9921B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BE32D0914132EE4008F2DEA /* Foundation.framework */; }; @@ -27,8 +28,8 @@ 7BD100F814136FD200A9921B /* GHUnitIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BD100F714136FD200A9921B /* GHUnitIOS.framework */; }; 7BD100FB141370B800A9921B /* NSDateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD100FA141370B800A9921B /* NSDateTest.m */; }; 7BE32D0A14132EE4008F2DEA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BE32D0914132EE4008F2DEA /* Foundation.framework */; }; - 7BE32D6A14133618008F2DEA /* NSString+sanity.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BE32D6814133618008F2DEA /* NSString+sanity.h */; }; - 7BE32D6B14133618008F2DEA /* NSString+sanity.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BE32D6914133618008F2DEA /* NSString+sanity.m */; }; + 7BE32D6A14133618008F2DEA /* NSString+marshmallows.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BE32D6814133618008F2DEA /* NSString+marshmallows.h */; }; + 7BE32D6B14133618008F2DEA /* NSString+marshmallows.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BE32D6914133618008F2DEA /* NSString+marshmallows.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,16 +43,17 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 7B2C8D7414159642004E1123 /* UIAlertView+simple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAlertView+simple.h"; sourceTree = ""; }; - 7B2C8D7514159642004E1123 /* UIAlertView+simple.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertView+simple.m"; sourceTree = ""; }; + 7B13A5701415FD2D0033DCC2 /* MMHTTPRequestTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMHTTPRequestTest.m; sourceTree = ""; }; + 7B2C8D7414159642004E1123 /* UIAlertView+marshmallows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAlertView+marshmallows.h"; sourceTree = ""; }; + 7B2C8D7514159642004E1123 /* UIAlertView+marshmallows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertView+marshmallows.m"; sourceTree = ""; }; 7B2C8D7F1415C450004E1123 /* UIAlertViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAlertViewDelegate.h; sourceTree = ""; }; 7B2C8D801415C450004E1123 /* UIAlertViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAlertViewDelegate.m; sourceTree = ""; }; 7BD100A0141341EB00A9921B /* MMHTTPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMHTTPClient.h; sourceTree = ""; }; 7BD100A1141341EB00A9921B /* MMHTTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMHTTPClient.m; sourceTree = ""; }; 7BD100A414134FBE00A9921B /* MMHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMHTTPRequest.h; sourceTree = ""; }; 7BD100A514134FBE00A9921B /* MMHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMHTTPRequest.m; sourceTree = ""; }; - 7BD100A8141353B700A9921B /* NSDate+relative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+relative.h"; sourceTree = ""; }; - 7BD100A9141353B700A9921B /* NSDate+relative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+relative.m"; sourceTree = ""; }; + 7BD100A8141353B700A9921B /* NSDate+marshmallows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+marshmallows.h"; sourceTree = ""; }; + 7BD100A9141353B700A9921B /* NSDate+marshmallows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+marshmallows.m"; sourceTree = ""; }; 7BD100B61413675100A9921B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 7BD100B91413675100A9921B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; 7BD100D514136F7500A9921B /* MarshmallowsTesting.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarshmallowsTesting.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -65,8 +67,8 @@ 7BE32D0914132EE4008F2DEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 7BE32D0D14132EE4008F2DEA /* Marshmallows-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Marshmallows-Prefix.pch"; sourceTree = ""; }; 7BE32D0E14132EE4008F2DEA /* Marshmallows.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Marshmallows.h; sourceTree = ""; }; - 7BE32D6814133618008F2DEA /* NSString+sanity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+sanity.h"; sourceTree = ""; }; - 7BE32D6914133618008F2DEA /* NSString+sanity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+sanity.m"; sourceTree = ""; }; + 7BE32D6814133618008F2DEA /* NSString+marshmallows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+marshmallows.h"; sourceTree = ""; }; + 7BE32D6914133618008F2DEA /* NSString+marshmallows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+marshmallows.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -97,6 +99,7 @@ isa = PBXGroup; children = ( 7BD100FA141370B800A9921B /* NSDateTest.m */, + 7B13A5701415FD2D0033DCC2 /* MMHTTPRequestTest.m */, 7BD100DB14136F7500A9921B /* Supporting Files */, ); path = MarshmallowsTesting; @@ -151,12 +154,12 @@ 7BD100A1141341EB00A9921B /* MMHTTPClient.m */, 7BD100A414134FBE00A9921B /* MMHTTPRequest.h */, 7BD100A514134FBE00A9921B /* MMHTTPRequest.m */, - 7BD100A8141353B700A9921B /* NSDate+relative.h */, - 7BD100A9141353B700A9921B /* NSDate+relative.m */, - 7BE32D6814133618008F2DEA /* NSString+sanity.h */, - 7BE32D6914133618008F2DEA /* NSString+sanity.m */, - 7B2C8D7414159642004E1123 /* UIAlertView+simple.h */, - 7B2C8D7514159642004E1123 /* UIAlertView+simple.m */, + 7BD100A8141353B700A9921B /* NSDate+marshmallows.h */, + 7BD100A9141353B700A9921B /* NSDate+marshmallows.m */, + 7BE32D6814133618008F2DEA /* NSString+marshmallows.h */, + 7BE32D6914133618008F2DEA /* NSString+marshmallows.m */, + 7B2C8D7414159642004E1123 /* UIAlertView+marshmallows.h */, + 7B2C8D7514159642004E1123 /* UIAlertView+marshmallows.m */, 7B2C8D7F1415C450004E1123 /* UIAlertViewDelegate.h */, 7B2C8D801415C450004E1123 /* UIAlertViewDelegate.m */, 7BE32D0C14132EE4008F2DEA /* Supporting Files */, @@ -182,9 +185,9 @@ 7BD100AC141364A900A9921B /* Marshmallows.h in Headers */, 7BD100A2141341EB00A9921B /* MMHTTPClient.h in Headers */, 7BD100A614134FBE00A9921B /* MMHTTPRequest.h in Headers */, - 7BE32D6A14133618008F2DEA /* NSString+sanity.h in Headers */, - 7BD100AA141353B700A9921B /* NSDate+relative.h in Headers */, - 7B2C8D7614159642004E1123 /* UIAlertView+simple.h in Headers */, + 7BE32D6A14133618008F2DEA /* NSString+marshmallows.h in Headers */, + 7BD100AA141353B700A9921B /* NSDate+marshmallows.h in Headers */, + 7B2C8D7614159642004E1123 /* UIAlertView+marshmallows.h in Headers */, 7B2C8D811415C450004E1123 /* UIAlertViewDelegate.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -271,6 +274,7 @@ files = ( 7BD100E114136F7500A9921B /* main.m in Sources */, 7BD100FB141370B800A9921B /* NSDateTest.m in Sources */, + 7B13A5711415FD2D0033DCC2 /* MMHTTPRequestTest.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -278,11 +282,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7BE32D6B14133618008F2DEA /* NSString+sanity.m in Sources */, + 7BE32D6B14133618008F2DEA /* NSString+marshmallows.m in Sources */, 7BD100A3141341EB00A9921B /* MMHTTPClient.m in Sources */, 7BD100A714134FBE00A9921B /* MMHTTPRequest.m in Sources */, - 7BD100AB141353B700A9921B /* NSDate+relative.m in Sources */, - 7B2C8D7714159642004E1123 /* UIAlertView+simple.m in Sources */, + 7BD100AB141353B700A9921B /* NSDate+marshmallows.m in Sources */, + 7B2C8D7714159642004E1123 /* UIAlertView+marshmallows.m in Sources */, 7B2C8D821415C450004E1123 /* UIAlertViewDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Marshmallows/Marshmallows.h b/Marshmallows/Marshmallows.h index 0d703cb..cc9f04e 100644 --- a/Marshmallows/Marshmallows.h +++ b/Marshmallows/Marshmallows.h @@ -8,6 +8,6 @@ #import -#import "NSDate+relative.h" -#import "NSString+sanity.h" -#import "UIAlertView+simple.h" +#import "NSDate+marshmallows.h" +#import "NSString+marshmallows.h" +#import "UIAlertView+marshmallows.h" diff --git a/Marshmallows/NSDate+relative.h b/Marshmallows/NSDate+marshmallows.h similarity index 56% rename from Marshmallows/NSDate+relative.h rename to Marshmallows/NSDate+marshmallows.h index 7d4322d..58bd22a 100644 --- a/Marshmallows/NSDate+relative.h +++ b/Marshmallows/NSDate+marshmallows.h @@ -1,5 +1,5 @@ // -// NSDate+relative.h +// NSDate+marshmallows.h // UberClassifieds // // Created by Sami Samhuri on 11-06-18. @@ -9,8 +9,9 @@ #import -@interface NSDate (NSDate_relative) +@interface NSDate (NSDate_marshmallows) ++ (NSDate *) dateWithYear: (NSInteger)year month: (NSInteger)month day: (NSInteger)day; - (NSString *) relativeToNow; @end diff --git a/Marshmallows/NSDate+relative.m b/Marshmallows/NSDate+marshmallows.m similarity index 84% rename from Marshmallows/NSDate+relative.m rename to Marshmallows/NSDate+marshmallows.m index 68e99be..bc5d3fc 100644 --- a/Marshmallows/NSDate+relative.m +++ b/Marshmallows/NSDate+marshmallows.m @@ -1,12 +1,12 @@ // -// NSDate+relative.m +// NSDate+marshmallows.m // UberClassifieds // // Created by Sami Samhuri on 11-06-18. // Copyright 2011 Betastreet Media. All rights reserved. // -#import "NSDate+relative.h" +#import "NSDate+marshmallows.h" #define MINUTE 60.0 #define HOUR (60.0 * MINUTE) @@ -15,7 +15,17 @@ #define MONTH (30.0 * DAY) #define YEAR (365.25 * DAY) -@implementation NSDate (NSDate_relative) +@implementation NSDate (NSDate_marshmallows) + ++ (NSDate *) dateWithYear: (NSInteger)year month: (NSInteger)month day: (NSInteger)day +{ + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease]; + [components setYear: year]; + [components setMonth: month]; + [components setDay: day]; + return [calendar dateFromComponents: components]; +} - (NSString *) relativeToNow { diff --git a/Marshmallows/NSString+sanity.h b/Marshmallows/NSString+marshmallows.h similarity index 86% rename from Marshmallows/NSString+sanity.h rename to Marshmallows/NSString+marshmallows.h index ac5b841..57b2f10 100644 --- a/Marshmallows/NSString+sanity.h +++ b/Marshmallows/NSString+marshmallows.h @@ -1,5 +1,5 @@ // -// NSString+sanity.h +// NSString+marshmallows.h // Marshmallows // // Created by Sami Samhuri on 11-09-03. @@ -8,7 +8,7 @@ #import -@interface NSString (NSString_sanity) +@interface NSString (NSString_marshmallows) - (NSString *) firstMatch: (NSString *)pattern; - (NSString *) stringByReplacing: (NSString *)pattern with: (NSString *)replacement; diff --git a/Marshmallows/NSString+sanity.m b/Marshmallows/NSString+marshmallows.m similarity index 96% rename from Marshmallows/NSString+sanity.m rename to Marshmallows/NSString+marshmallows.m index 415ebad..4f36208 100644 --- a/Marshmallows/NSString+sanity.m +++ b/Marshmallows/NSString+marshmallows.m @@ -1,12 +1,12 @@ // -// NSString+sanity.m +// NSString+marshmallows.m // Marshmallows // // Created by Sami Samhuri on 11-09-03. // Copyright 2011 Guru Logic. All rights reserved. // -#import "NSString+sanity.h" +#import "NSString+marshmallows.h" // Encode a string to embed in an URL. NSString* URLEncode(NSString *string) { @@ -19,7 +19,7 @@ NSString* URLEncode(NSString *string) { } -@implementation NSString (NSString_sanity) +@implementation NSString (NSString_marshmallows) - (NSString *) stringByTrimmingWhitespace { diff --git a/Marshmallows/UIAlertView+simple.h b/Marshmallows/UIAlertView+marshmallows.h similarity index 77% rename from Marshmallows/UIAlertView+simple.h rename to Marshmallows/UIAlertView+marshmallows.h index b91239e..b24b882 100644 --- a/Marshmallows/UIAlertView+simple.h +++ b/Marshmallows/UIAlertView+marshmallows.h @@ -1,5 +1,5 @@ // -// UIAlertView+simple.h +// UIAlertView+marshmallows.h // DatingX // // Created by Sami Samhuri on 11-08-24. @@ -10,7 +10,7 @@ typedef void (^UIAlertViewCallback)(BOOL ok); -@interface UIAlertView (UIAlertView_simple) +@interface UIAlertView (UIAlertView_marshmallows) + (void) showAlertWithTitle: (NSString *)title message: (NSString *)message; diff --git a/Marshmallows/UIAlertView+simple.m b/Marshmallows/UIAlertView+marshmallows.m similarity index 87% rename from Marshmallows/UIAlertView+simple.m rename to Marshmallows/UIAlertView+marshmallows.m index 04f106a..36d3e3d 100644 --- a/Marshmallows/UIAlertView+simple.m +++ b/Marshmallows/UIAlertView+marshmallows.m @@ -1,15 +1,15 @@ // -// UIAlertView+simple.m +// UIAlertView+marshmallows.m // DatingX // // Created by Sami Samhuri on 11-08-24. // Copyright 2011 __MyCompanyName__. All rights reserved. // -#import "UIAlertView+simple.h" +#import "UIAlertView+marshmallows.h" #import "UIAlertViewDelegate.h" -@implementation UIAlertView (UIAlertView_simple) +@implementation UIAlertView (UIAlertView_marshmallows) + (void) showAlertWithTitle: (NSString *)title message: (NSString *)message { diff --git a/Marshmallows/UIAlertViewDelegate.h b/Marshmallows/UIAlertViewDelegate.h index 5cf5c57..997526a 100644 --- a/Marshmallows/UIAlertViewDelegate.h +++ b/Marshmallows/UIAlertViewDelegate.h @@ -7,7 +7,7 @@ // #import -#import "UIAlertView+simple.h" +#import "UIAlertView+marshmallows.h" @interface UIAlertViewDelegate : NSObject { diff --git a/MarshmallowsTesting/NSDateTest.m b/MarshmallowsTesting/NSDateTest.m index ed0edf7..8e77997 100644 --- a/MarshmallowsTesting/NSDateTest.m +++ b/MarshmallowsTesting/NSDateTest.m @@ -7,7 +7,7 @@ // #import -#import "NSDate+relative.h" +#import "NSDate+marshmallows.h" #define MINUTE 60.0 #define HOUR (60.0 * MINUTE)