Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding tests to importing data from NSObject+TKCategory. Documenting …

…new stuff.
  • Loading branch information...
commit c79bff4a24dcaebdcc663f00754354c0aefe9950 1 parent 4f60858
@devinross authored
View
2  README.mdown
@@ -9,4 +9,4 @@ Browse the documentation at [devinsheaven.com/tapku/documentation](http://devins
Instructions on adding tapku library can be [found here](https://github.com/devinross/tapkulibrary/wiki/Adding-Tapku-to-Your-Project-in-XCode-4). For additional help, check out the demo project.
-Follow me on twitter, [@devin_ross](http://twitter.com/devin_ross).
+Follow me on twitter [@devin_ross](http://twitter.com/devin_ross).
View
4 demo/Classes/RootViewController.m
@@ -101,8 +101,8 @@ - (void) viewDidLoad{
self.data = @[
- @{@"rows" : @[COVERFLOW,MONTH_GRID,DAY_VIEW,WEB_VC], @"title" : @"Views"},
- @{@"rows" : @[EMPTY_SIGN,HUD,ALERTS,SLIDE,BUTTONS,CUSTOM_KEYBOARDS], @"title" : @"UI Elements"},
+ @{@"rows" : @[WEB_VC,DAY_VIEW,MONTH_GRID,COVERFLOW], @"title" : @"Views"},
+ @{@"rows" : @[SLIDE,BUTTONS,CUSTOM_KEYBOARDS,HUD,EMPTY_SIGN,ALERTS], @"title" : @"UI Elements"},
@{@"rows" : @[LABEL_CELLS,MORE_CELLS], @"title" : @"Table View Cells"},
@{@"rows" : @[IMAGE_CACHE,HTTP_PROGRESS], @"title" : @"Network"}];
}
View
67 src/DataTests.m
@@ -45,8 +45,12 @@ @interface SampleItem : NSObject
@property (nonatomic,strong) NSDate *deletedAt;
@property (nonatomic,strong) NSDate *finishedAt;
+@property (nonatomic,strong) SampleItem *parentItem;
+@property (nonatomic,strong) NSArray *childItems;
+
@end
+
@implementation SampleItem
+ (NSDictionary*) dataKeys{
@@ -56,14 +60,19 @@ + (NSDictionary*) dataKeys{
@"createdAt" : @[@"created_at",@"yyyy-MM-dd'T'HH:mm:ss"],
@"updatedAt" : @[@"updated_at",@"yyyy-MM-dd"],
@"deletedAt" : @[@"deleted_at"],
- @"finishedAt" : @[@"finished_at",@"yyyy-MM-dd"]};
+ @"finishedAt" : @[@"finished_at",@"yyyy-MM-dd"],
+ @"parentItem" : @{@"class": NSStringFromClass([SampleItem class]), @"key": @"parent" },
+ @"childItems" : @{@"class": NSStringFromClass([SampleItem class]), @"key": @"children", @"structure" : NSStringFromClass([NSArray class]) },
+
+
+ };
}
@end
@implementation DataTests
-- (void) testDataImporting{
+- (void) testShouldProperlyImportData{
NSDictionary *dict = @{
@"id" : @8000,
@@ -73,7 +82,9 @@ - (void) testDataImporting{
@"position" : [NSNull null],
@"phone" : @"1-800-123-4567",
@"deletedAt" : @"2012-03-12",
- @"finishedAt" : [NSNull null]
+ @"finishedAt" : [NSNull null],
+ @"children" : @[@{@"id": @5},@{@"id": @20}],
+ @"parent" : @{@"id": @5}
};
@@ -102,12 +113,60 @@ - (void) testDataImporting{
XCTAssertTrue([item.updatedAt isKindOfClass:[NSDate class]], @"SampleItem 'updatedAt' property is not a NSDate class.");
+ XCTAssertTrue([item.parentItem isKindOfClass:[SampleItem class]], @"SampleItem 'parent' property is not a SampleItem class.");
+
+ XCTAssertTrue([item.parentItem.identifier isEqualToNumber:@5], @"SampleItem's parent doesn't have an id of 5.");
+
+
+ XCTAssertTrue([item.childItems isKindOfClass:[NSArray class]], @"SampleItem 'childItems' property is not a NSArray class.");
+
+
+ SampleItem *child1 = item.childItems.firstObject;
+ SampleItem *child2 = item.childItems.lastObject;
+
+
+ XCTAssertTrue([child1.identifier isEqualToNumber:@5], @"SampleItem's child doesn't have an id of 5.");
+ XCTAssertTrue([child2.identifier isEqualToNumber:@20], @"SampleItem's child doesn't have an id of 5.");
+
+}
+
+- (void) testShouldHandleImportingAClassStrucureWhenContentIsntADictionary{
+ NSDictionary *dict = @{@"id" : @8000,
+ @"created_at" : @"2012-03-12T18:45:00",
+ @"updated_at" : @"2013-04-15",
+ @"name" : @"Bobby Sanderson",
+ @"position" : [NSNull null],
+ @"phone" : @"1-800-123-4567",
+ @"deletedAt" : @"2012-03-12",
+ @"finishedAt" : [NSNull null],
+ @"parent" : @[@5,@4] };
+
+ XCTAssertNoThrow([SampleItem createObject:dict], @"We don't throw exception when ");
+
+}
+
+- (void) testShouldHandleImportingAClassArrayStrucureWhenArrayContentsIsntDictionaries{
+
+ NSDictionary *dict = @{@"id" : @8000,
+ @"created_at" : @"2012-03-12T18:45:00",
+ @"updated_at" : @"2013-04-15",
+ @"name" : @"Bobby Sanderson",
+ @"position" : [NSNull null],
+ @"phone" : @"1-800-123-4567",
+ @"deletedAt" : @"2012-03-12",
+ @"finishedAt" : [NSNull null],
+ @"children" : @[@5,@4] };
+
+ XCTAssertNoThrow([SampleItem createObject:dict], @"We don't throw exception when ");
+
}
-- (void) testNoData{
+
+
+- (void) testShouldHandleWhenDataIsNotADictionaryProperly{
SampleItem *item;
item = [SampleItem createObject:(id)[NSNull null]];
View
10 src/TapkuLibrary.xcodeproj/project.pbxproj
@@ -1013,10 +1013,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = YES;
- OTHER_LDFLAGS = (
- "-all_load",
- "-ObjC",
- );
+ OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
WARNING_CFLAGS = "-Wno-arc-performSelector-leaks";
};
@@ -1033,10 +1030,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = NO;
- OTHER_LDFLAGS = (
- "-all_load",
- "-ObjC",
- );
+ OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
WARNING_CFLAGS = "-Wno-arc-performSelector-leaks";
};
View
15 src/TapkuLibrary/NSDate+TKCategory.h
@@ -29,8 +29,6 @@
*/
-
-
@import Foundation;
#pragma mark - NSDate + TKCategory
@@ -45,8 +43,8 @@
+ (NSDate *) yesterday;
/** Creates and returns a new date set to the previous day and current time.
+ Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
@param timeZone The time zone to repect.
- @note Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
@return A `NSDate` object set to yesterday.
*/
+ (NSDate*) yesterdayWithTimeZone:(NSTimeZone*)timeZone;
@@ -59,8 +57,9 @@
+ (NSDate*) tomorrow;
/** Creates and returns a new date set to the tomorrow's day and current time.
+ Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
+
@param timeZone The time zone to repect.
- @note Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
@return A `NSDate` object set to tomorrow.
*/
+ (NSDate*) tomorrowWithTimeZone:(NSTimeZone*)timeZone;
@@ -73,8 +72,9 @@
+ (NSDate *) month;
/** Creates and returns a new date set to the current month date.
+ Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
+
@param timeZone The time zone to repect.
- @note Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
@return A `NSDate` object set to the current month.
*/
+ (NSDate*) monthWithTimeZone:(NSTimeZone*)timeZone;
@@ -85,8 +85,9 @@
- (NSDate*) monthDate;
/** Creates and returns a new date set to the first day of the month from the date object.
+ Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
+
@param timeZone Time Zone for month.
- @note Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
@return A `NSDate` object set to the same month as the date object. The day will be the first of the month.
*/
- (NSDate *) monthDateWithTimeZone:(NSTimeZone*)timeZone;
@@ -111,7 +112,6 @@
#pragma mark Same Month
/** Returns whether the compared date shares the month with respect to the given time zone.
@param anotherDate The date to compare.
- @param timeZone The time zone used to determine the current day.
@return YES if the two dates share the same year, month. Otherwise NO.
*/
- (BOOL) isSameMonth:(NSDate *)anotherDate;
@@ -126,7 +126,6 @@
#pragma mark Same Year
/** Returns whether the compared date shares the year with respect to the given time zone.
@param anotherDate The date to compare.
- @param timeZone The time zone used to determine the current day.
@return YES if the two dates share the same year. Otherwise NO.
*/
- (BOOL) isSameYear:(NSDate *)anotherDate;
View
53 src/TapkuLibrary/NSObject+TKCategory.m
@@ -47,51 +47,58 @@ + (id) createObject:(NSDictionary*)data{
- (id) initWithDataDictionary:(NSDictionary*)dictionary{
if((id)dictionary == [NSNull null]) return nil;
if(!(self=[self init])) return nil;
- [self importDataWithDictionary:dictionary];
+ [self importDataWithDictionary:VALID_OBJECT(dictionary)?dictionary:nil];
return self;
}
-- (void) importDataWithDictionary:(NSDictionary*)dictionary{
+- (void) importDataWithDictionary:(NSDictionary*)rawData{
NSDateFormatter *formatter = nil;
- NSDictionary *dataKeys = [[self class] dataKeys];
+ NSDictionary *propertyKeys = [[self class] dataKeys];
- for(NSString *propertyKey in [dataKeys allKeys]){
+ for(NSString *propertyKey in propertyKeys.allKeys){
- id value = dataKeys[propertyKey];
+ id jsonKey = propertyKeys[propertyKey];
- if([value isKindOfClass:[NSString class]]){
+ if([jsonKey isKindOfClass:[NSString class]]){
- id obj = dictionary[dataKeys[propertyKey]];
+ id obj = rawData[jsonKey];
if(VALID_OBJECT(obj)) [self setValue:obj forKey:propertyKey];
- }else if([value isKindOfClass:[NSArray class]]){
+ }else if([jsonKey isKindOfClass:[NSArray class]]){
- NSString *format = [value lastObject];
- NSString *key = [value firstObject];
+ NSString *format = [jsonKey lastObject];
+ jsonKey = [jsonKey firstObject];
- if(VALID_OBJECT(format) && VALID_OBJECT(key) && VALID_OBJECT(dictionary[key])){
+ if(VALID_OBJECT(format) && VALID_OBJECT(jsonKey) && VALID_OBJECT(rawData[jsonKey])){
if(!formatter) formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:format];
- NSDate *date = [formatter dateFromString:dictionary[key]];
+ NSDate *date = [formatter dateFromString:rawData[jsonKey]];
[self setValue:date forKey:propertyKey];
}
- }else if([value isKindOfClass:[NSDictionary class]]){
+ }else if([jsonKey isKindOfClass:[NSDictionary class]]){
- NSDictionary *dataKeyDictionary = (NSDictionary*)value;
+ NSDictionary *dataKeyDictionary = (NSDictionary*)jsonKey;
Class class = NSClassFromString(dataKeyDictionary[@"class"]);
- id key = dataKeyDictionary[@"key"];
+ jsonKey = dataKeyDictionary[@"key"];
- if([dictionary[key] isKindOfClass:[NSDictionary class]] || [dictionary[key] isKindOfClass:[NSArray class]]){
+ if([rawData[jsonKey] isKindOfClass:[NSDictionary class]] || [rawData[jsonKey] isKindOfClass:[NSArray class]]){
Class structure = NSClassFromString(dataKeyDictionary[@"structure"]);
if(structure == [NSArray class]){
- NSArray *array = dictionary[key];
- NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:array.count];
- for(NSDictionary *subDictionary in array)
- [mutableArray addObject:[class createObject:subDictionary]];
- [self setValue:mutableArray.copy forKey:propertyKey];
- }else{
- id obj = [class createObject:dictionary[key]];
+ if([rawData[jsonKey] isKindOfClass:[NSArray class]]){
+ NSArray *rawArray = rawData[jsonKey];
+ NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:rawArray.count];
+ for(NSDictionary *subDictionary in rawArray){
+
+
+ if([subDictionary isKindOfClass:[NSDictionary class]])
+ [mutableArray addObject:[class createObject:subDictionary]];
+
+ }
+ [self setValue:mutableArray.copy forKey:propertyKey];
+ }
+ }else if([rawData[jsonKey] isKindOfClass:[NSDictionary class]]){
+ id obj = [class createObject:rawData[jsonKey]];
[self setValue:obj forKeyPath:propertyKey];
}
}else{
View
4 src/TapkuLibrary/TKAlertViewController.h
@@ -56,13 +56,13 @@
/**
Overwrite this function to implement your own presentation animation.
- @transitionContext The transition context.
+ @param transitionContext The transition context.
*/
- (void) showAlertView:(id<UIViewControllerContextTransitioning>)transitionContext;
/**
Overwrite this function to implement your own dismissal animation.
- @transitionContext The transition context.
+ @param transitionContext The transition context.
*/
- (void) hideAlertView:(id<UIViewControllerContextTransitioning>)transitionContext;
View
9 src/TapkuLibrary/TKAppDelegate.h
@@ -34,7 +34,7 @@
@class TKWindow;
-/** This class allocates a TKWindow instance and provides a convience method for application launching. */
+/** This class allocates a `TKWindow` instance and provides a convience method for application launching. */
@interface TKAppDelegate : NSObject <UIApplicationDelegate>
@@ -42,9 +42,10 @@
Apple recommends placing initialization of
application:willFinishLaunchingWithOptions (instead of didFinish)
for iOS 6 despite its absence in previous versions of iOS.
- Subclassing the method will take care of that recommendation. The
- UIWindow for the application is allocated and setup just before
- this method is called. The default implementation does nothing.
+ Subclassing the method will take care of that recommendation
+ automatically. The UIWindow for the application is allocated and
+ setup just before this method is called. The default implementation
+ does nothing.
@param application The application instance.
@param launchOptions The launch options.
*/
View
6 src/TapkuLibrary/TKDecimalInputView.h
@@ -31,8 +31,14 @@
#import "TKNumberInputView.h"
+/** `TKDecimalInputView` is subclass `TKNumberInputView` with a decimal key. */
@interface TKDecimalInputView : TKNumberInputView
+///----------------------------
+/// @name Properties
+///----------------------------
+
+/** Decimal key. */
@property (nonatomic,strong) TKInputKey *decimalKey;
@end
View
8 src/TapkuLibrary/TKDecimalInputWithNextKeyView.h
@@ -31,9 +31,13 @@
#import "TKDecimalInputView.h"
+/** `TKDecimalInputWithNextKeyView` is subclass `TKDecimalInputView` with a next key. */
@interface TKDecimalInputWithNextKeyView : TKDecimalInputView
+///----------------------------
+/// @name Properties
+///----------------------------
+/** The next key. */
@property (nonatomic,strong) TKInputKey *nextKey;
-
-@end
+@end
View
7 src/TapkuLibrary/TKGlowButton.h
@@ -31,9 +31,14 @@
@import UIKit;
+/** `TKGlowButton` is a subclassed `UIButton` that allows the background of a button to glow on touch. */
@interface TKGlowButton : UIButton
-
+/**
+ This method allows you to set the background color during a certain state.
+ @param color The background color of the button.
+ @param state The state to which the color will appear.
+ */
- (void) setBackgroundColor:(UIColor*)color forState:(UIControlState)state;
@end
View
38 src/TapkuLibrary/TKInputKey.h
@@ -31,25 +31,61 @@
@import UIKit;
+/** An input key display type. */
typedef enum {
TKInputKeyTypeDefault = 0,
TKInputKeyTypeDark = 1,
TKInputKeyTypeHighlighted = 2
} TKInputKeyType;
+/** `TKInputKey` is an input key to be used by a `TKInputView`. */
@interface TKInputKey : UIView
+/** Initializes an input key.
+
+ @param frame The frame of the `UIView`.
+ @param symbol A image or string for the key.
+ @param normal A image or string for the key.
+ @param highlighted A image or string for the key.
+ @param runner If yes, the key can be highlighted and selected even if it isn't the initial key touched at the beginning.
+ @return An initialized `TKInputKey` object or nil if the object couldn’t be created.
+ */
+ (id) keyWithFrame:(CGRect)frame symbol:(id)symbol normalType:(TKInputKeyType)normal selectedType:(TKInputKeyType)highlighted runner:(BOOL)runner;
+
+/** Initializes an input key.
+
+ @param frame The frame of the `UIView`.
+ @param symbol A image or string for the key.
+ @param normal A image or string for the key.
+ @param highlighted A image or string for the key.
+ @param runner If yes, the key can be highlighted and selected even if it isn't the initial key touched at the beginning.
+ @return An initialized `TKInputKey` object or nil if the object couldn’t be created.
+ */
- (id) initWithFrame:(CGRect)frame symbol:(id)symbol normalType:(TKInputKeyType)normal selectedType:(TKInputKeyType)highlighted runner:(BOOL)runner;
+///----------------------------
+/// @name Properties
+///----------------------------
+
+/** The display mode when the key is in a normal state. */
@property (nonatomic,assign) TKInputKeyType normalType;
+
+/** The display mode when the key is in a highlighted state. */
@property (nonatomic,assign) TKInputKeyType highlighedType;
+
+/** If yes, the key can be highlighted and selected even if it isn't the initial key touched at the beginning. */
@property (nonatomic,assign) BOOL runner;
+
+/** The label that displays the text symbol. */
@property (nonatomic,strong) UILabel *label;
+
+/** The symbol image view. */
@property (nonatomic,strong) UIImageView *symbol;
+/** The backspace key.
+ @param highlighted A flag to set the key to highlighted. */
- (void) setHighlighted:(BOOL)highlighted;
-@end
+@end
View
36 src/TapkuLibrary/TKInputView.h
@@ -33,22 +33,54 @@
@class TKInputView;
@class TKInputKey;
+/** The delegate of a `TKInputView` object must adopt the `TKInputViewDelegate` protocol. */
@protocol TKInputViewDelegate <NSObject>
+/** When a key is tapped, this delegate method is invoked.
+ @param inputView The input view.
+ @param key The input key tapped.
+ @return
+ */
- (void) inputView:(TKInputView*)inputView didSelectKey:(TKInputKey*)key;
@end
+/**
+ `TKInputView` is intended to be a custom keyboard
+ that you can present to the user instead of the
+ customary Apple provided keyboards.
+ */
@interface TKInputView : UIView <UIInputViewAudioFeedback>
+
+/** Initializes an input view. Invoke this method for subclasses.
+
+ @param frame The frame of the `UIView`.
+ @param keys The keys included on the view.
+ @return An initialized `TKInputView` object or nil if the object couldn’t be created.
+ */
- (id) initWithFrame:(CGRect)frame withKeysModels:(NSArray*)keys;
-@property (nonatomic,assign) id <TKInputViewDelegate> delegate;
-@property (nonatomic,assign) UITextField *textField;
+///----------------------------
+/// @name Properties
+///----------------------------
+
+/** The delegate must adopt the `TKInputViewDelegate` protocol. The delegate is not retained. */
+@property (nonatomic,weak) id <TKInputViewDelegate> delegate;
+
+/** The text field using the custom input view. The text field is not retained. */
+@property (nonatomic,weak) UITextField *textField;
+
+/** The backspace key. */
@property (nonatomic,strong) TKInputKey *backspaceKey;
+
+/** The key that will resign the text field. */
@property (nonatomic,strong) TKInputKey *hideKeyboardKey;
+/** The current key that is being touched down. */
@property (nonatomic,readonly) TKInputKey *selectedKey;
+
+/** The view that contains all the keys. This view becomes useful when dealing with iPad formatting. */
@property (nonatomic,strong) UIView *containerView;
@end
View
36 src/TapkuLibrary/TKNumberInputView.h
@@ -32,23 +32,55 @@
#import "TKInputView.h"
@class TKInputKey;
+/** `TKNumberInputView` is subclass `TKInputView` with a number pad. */
@interface TKNumberInputView : TKInputView
-
+/** Initializes an number pad input view.
+
+ @param frame The frame of the `UIView`.
+ @param keys The keys included on the view.
+ @param padFrame The frame of the number pad.
+ @return An initialized `TKInputView` object or nil if the object couldn’t be created.
+ */
- (id) initWithFrame:(CGRect)frame withKeysModels:(NSArray*)keys keypadFrame:(CGRect)padFrame;
+///----------------------------
+/// @name Properties
+///----------------------------
+
+/** One key. */
@property (nonatomic,strong) TKInputKey *oneKey;
+
+/** Two key. */
@property (nonatomic,strong) TKInputKey *twoKey;
+
+/** Three key. */
@property (nonatomic,strong) TKInputKey *threeKey;
+
+/** Four key. */
@property (nonatomic,strong) TKInputKey *fourKey;
+
+/** Five key. */
@property (nonatomic,strong) TKInputKey *fiveKey;
+
+/** Six key. */
@property (nonatomic,strong) TKInputKey *sixKey;
+
+/** Seven key. */
@property (nonatomic,strong) TKInputKey *sevenKey;
+
+/** Eight key. */
@property (nonatomic,strong) TKInputKey *eightKey;
+
+/** Nine key. */
@property (nonatomic,strong) TKInputKey *nineKey;
-@property (nonatomic,strong) TKInputKey *zeroKey;
+/** Zero key. */
+@property (nonatomic,strong) TKInputKey *zeroKey;
+/** Zero key.
+ @return An array of all the number keys.
+ */
- (NSArray*) keypadKeys;
@end
View
5 src/TapkuLibrary/TKNumberInputWithNextKeyView.h
@@ -31,8 +31,13 @@
#import "TKNumberInputView.h"
+/** `TKNumberInputWithNextKeyView` is subclass `TKNumberInputView` with a next key. */
@interface TKNumberInputWithNextKeyView : TKNumberInputView
+///----------------------------
+/// @name Properties
+///----------------------------
+/** The next key. */
@property (nonatomic,strong) TKInputKey *nextKey;
@end
View
8 src/TapkuLibrary/TKRetroButton.h
@@ -31,9 +31,17 @@
@import UIKit;
+/** `TKRetroButton` is a subclassed `UIButton` with a rounded corner and border. */
@interface TKRetroButton : UIButton
+///----------------------------
+/// @name Properties
+///----------------------------
+
+/** The border width of the button. */
@property (nonatomic,assign) CGFloat borderWidth;
+
+/** The inset width between the highlighted background and border. */
@property (nonatomic,assign) CGFloat insetWidth;
@end
View
8 src/TapkuLibrary/TKShimmerLabel.h
@@ -31,14 +31,22 @@
@import UIKit;
+/** The direction of the shimmering on the label. */
typedef enum {
TKShimmerLabelDirectionLeftToRight,
TKShimmerLabelDirectionRightToLeft
} TKShimmerLabelDirection;
+/** `TKShimmerLabel` is a subclassed `UILabel` with a shimmer animation similiar to the unlock screen. */
@interface TKShimmerLabel : UILabel
+///----------------------------
+/// @name Properties
+///----------------------------
+/** The gradient layer that masks the text label to create the shimmer effect. */
@property (nonatomic,strong) CAGradientLayer *textHighlightLayer;
+
+/** The direction the shimmer should move. */
@property (nonatomic,assign) TKShimmerLabelDirection direction;
@end
View
17 src/TapkuLibrary/TKSlideToUnlockView.h
@@ -33,21 +33,36 @@
@import AudioToolbox;
@class TKShimmerLabel;
+/** The mode that the slider to unlock view is in. */
typedef enum {
TKSlideToUnlockViewModeNormal = 0,
TKSlideToUnlockViewModeDisabled = 1
} TKSlideToUnlockViewMode;
-
+/** `TKSlideToUnlockView` is a control that allows users to slide to unlock like you would the lock screen. */
@interface TKSlideToUnlockView : UIControl <UIScrollViewDelegate>
+///----------------------------
+/// @name Properties
+///----------------------------
+/** The shimmering text label that directs the user to act. */
@property (nonatomic,strong) TKShimmerLabel *textLabel;
+
+/** The scroll view that the user slides */
@property (nonatomic,strong) UIScrollView *scrollView;
+
+/** The view behind the scroll view */
@property (nonatomic,strong) UIImageView *backgroundView;
+
+/** A read-only property to tell whether to tell the state of the view */
@property (nonatomic,readonly) BOOL isUnlocked;
+/** The mode flag to enable of disable the view from acting. If disabled the device will vibrate. */
@property (nonatomic,assign) TKSlideToUnlockViewMode mode;
+/** Reset the slider view to the original position.
+ @param animated If yes, the view will animate to a reset position.
+ */
- (void) resetSlider:(BOOL)animated;
@end
View
25 src/TapkuLibrary/TKSoundAlertController.h
@@ -33,14 +33,35 @@
@import AVFoundation;
@import AudioToolbox;
+/** `TKSoundAlertController` plays simple user interface sounds. */
@interface TKSoundAlertController : NSObject <AVAudioPlayerDelegate>
+/** Returns the singleton sound alert controller.
+ @return The shared instance sound alert controller object.
+ */
+ (TKSoundAlertController*) sharedInstance;
-@property (assign,nonatomic) BOOL on;
-
+/** Plays a sound file immediately.
+ @param soundName Plays a sound file with name 'insert-sound-name'.aif
+ */
+ (void) playAIF:(NSString*)soundName;
+
+/** Plays a sound file immediately.
+ @param soundName Plays a sound file with name 'insert-sound-name'.aiff
+ */
+ (void) playAIFF:(NSString*)soundName;
+
+/** Plays a sound file immediately.
+ @param soundName Plays a sound file with name 'insert-sound-name'.wav
+ */
+ (void) playWAV:(NSString*)soundName;
+
+///----------------------------
+/// @name Properties
+///----------------------------
+/** Flag to enable the play of the sound. If off, it will not play the sound. Default is off. */
+@property (assign,nonatomic,getter = isOn) BOOL on;
+
+
@end
View
1  src/TapkuLibrary/TKSoundAlertController.m
@@ -39,7 +39,6 @@ @interface TKSoundAlertController ()
@implementation TKSoundAlertController
-
+ (TKSoundAlertController*)sharedInstance {
static TKSoundAlertController *instance = nil;
if (!instance) {
View
15 src/TapkuLibrary/TKTextView.h
@@ -31,12 +31,21 @@
@import UIKit;
+/** This class creates a `UITextView` with placeholder text. */
@interface TKTextView : UITextView
+///----------------------------
+/// @name Properties
+///----------------------------
+
+/** The placeholder label. */
@property (nonatomic,strong) UILabel *placeHolderLabel;
-@property (nonatomic,strong) NSString *placeholder;
-@property (nonatomic,strong) UIColor *placeholderColor;
+/** The placeholder text. */
+@property (nonatomic,strong) NSString *placeholder;
+
+/** The text color of the placehold text. */
+@property (nonatomic,strong) UIColor *placeholderColor;
-@end
+@end
View
3  src/Tests/FoundationTests.m
@@ -63,9 +63,8 @@ - (void) testDateCategory{
date = [NSDate date];
date2 = [NSDate yesterday];
-
NSInteger diff = [date daysBetweenDate:date2];
- XCTAssertEqualObjects(@(diff), @1, @"Expected difference between %@ and %@ is 1, but found %ld.",date,date2,diff);
+ XCTAssertEqualObjects(@(diff), @1, @"Expected difference between %@ and %@ is 1, but found %@.",date,date2,@(diff));
}
Please sign in to comment.
Something went wrong with that request. Please try again.