Skip to content

Commit

Permalink
Rename BONChainable to BONTextable and textAndApplyChainable to bonSt…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
Imperiopolis committed Mar 12, 2016
1 parent b204bc0 commit 882911a
Show file tree
Hide file tree
Showing 20 changed files with 171 additions and 173 deletions.
8 changes: 4 additions & 4 deletions Example/BonMot.xcodeproj/project.pbxproj
Expand Up @@ -19,7 +19,7 @@
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
6836AD13A829A45AE2425588 /* Pods_BonMot_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CFD6D97A946F2FEF294F4BBB /* Pods_BonMot_Tests.framework */; };
CD6DEFE11BF6ADF900676E2D /* BONBaseTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6DEFD61BF6ADF900676E2D /* BONBaseTestCase.m */; };
CD6DEFE31BF6ADF900676E2D /* BONChainableTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6DEFD71BF6ADF900676E2D /* BONChainableTestCase.m */; };
CD6DEFE31BF6ADF900676E2D /* BONTextableTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6DEFD71BF6ADF900676E2D /* BONTextableTestCase.m */; };
CD6DEFE51BF6ADF900676E2D /* BONChainEmptyStringTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6DEFD81BF6ADF900676E2D /* BONChainEmptyStringTestCase.m */; };
CD6DEFE71BF6ADF900676E2D /* BONDebugStringTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6DEFD91BF6ADF900676E2D /* BONDebugStringTestCase.m */; };
CD6DEFE91BF6ADF900676E2D /* BONDictionaryEqualityTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6DEFDA1BF6ADF900676E2D /* BONDictionaryEqualityTestCase.m */; };
Expand Down Expand Up @@ -99,7 +99,7 @@
AEA43FE0E796D75B40E7EF87 /* Pods-BonMot_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BonMot_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-BonMot_Tests/Pods-BonMot_Tests.release.xcconfig"; sourceTree = "<group>"; };
CD6DEFD51BF6ADF900676E2D /* BONBaseTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BONBaseTestCase.h; sourceTree = "<group>"; };
CD6DEFD61BF6ADF900676E2D /* BONBaseTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONBaseTestCase.m; sourceTree = "<group>"; };
CD6DEFD71BF6ADF900676E2D /* BONChainableTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONChainableTestCase.m; sourceTree = "<group>"; };
CD6DEFD71BF6ADF900676E2D /* BONTextableTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONTextableTestCase.m; sourceTree = "<group>"; };
CD6DEFD81BF6ADF900676E2D /* BONChainEmptyStringTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONChainEmptyStringTestCase.m; sourceTree = "<group>"; };
CD6DEFD91BF6ADF900676E2D /* BONDebugStringTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONDebugStringTestCase.m; sourceTree = "<group>"; };
CD6DEFDA1BF6ADF900676E2D /* BONDictionaryEqualityTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BONDictionaryEqualityTestCase.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -270,7 +270,7 @@
children = (
CD6DEFD51BF6ADF900676E2D /* BONBaseTestCase.h */,
CD6DEFD61BF6ADF900676E2D /* BONBaseTestCase.m */,
CD6DEFD71BF6ADF900676E2D /* BONChainableTestCase.m */,
CD6DEFD71BF6ADF900676E2D /* BONTextableTestCase.m */,
CD6DEFD81BF6ADF900676E2D /* BONChainEmptyStringTestCase.m */,
CD6DEFD91BF6ADF900676E2D /* BONDebugStringTestCase.m */,
CD6DEFDA1BF6ADF900676E2D /* BONDictionaryEqualityTestCase.m */,
Expand Down Expand Up @@ -608,7 +608,7 @@
CD6DEFED1BF6ADF900676E2D /* BONPropertyClobberingTestCase.m in Sources */,
CD6DEFF11BF6ADF900676E2D /* BONTextAlignmentTestCase.m in Sources */,
CD6DEFE11BF6ADF900676E2D /* BONBaseTestCase.m in Sources */,
CD6DEFE31BF6ADF900676E2D /* BONChainableTestCase.m in Sources */,
CD6DEFE31BF6ADF900676E2D /* BONTextableTestCase.m in Sources */,
CDE658581C24ADD8009C7D09 /* BONUnderlineAndStrikethroughTestCase.m in Sources */,
CD6DEFF31BF6ADF900676E2D /* BONTrackingTestCase.m in Sources */,
CD6DEFE91BF6ADF900676E2D /* BONDictionaryEqualityTestCase.m in Sources */,
Expand Down
1 change: 0 additions & 1 deletion Example/Pods/Headers/Private/BonMot/BONChainable.h

This file was deleted.

1 change: 1 addition & 0 deletions Example/Pods/Headers/Private/BonMot/BONTextable.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 64 additions & 64 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Pods/Target Support Files/BonMot/BonMot-umbrella.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,5 +1,5 @@
//
// BONChainableTestCase.m
// BONTextableTestCase.m
// BonMot
//
// Created by Zev Eisenberg on 10/9/15.
Expand All @@ -10,11 +10,11 @@

@import BonMot;

@interface BONChainableTestCase : BONBaseTestCase
@interface BONTextableTestCase : BONBaseTestCase

@end

@implementation BONChainableTestCase
@implementation BONTextableTestCase

- (void)testConcatenation
{
Expand Down
64 changes: 32 additions & 32 deletions Example/Tests/BONUtilitiesTestCase.m
Expand Up @@ -37,11 +37,11 @@ @implementation BONUtilitiesTestCase

#pragma mark - UILabel

- (void)testLabelTextAfterChainable
- (void)testLabelTextAfterTextable
{
UILabel *label = UILabel.new;
label.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
label.textAndApplyChainable = @"Hello, world!";
label.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);
label.bonString = @"Hello, world!";

XCTAssertEqualObjects(label.attributedText.string, @"Hello, world!");

Expand All @@ -57,11 +57,11 @@ - (void)testLabelTextAfterChainable
BONAssertAttributedStringHasAttributes(label.attributedText, controlAttributes);
}

- (void)testLabelTextBeforeChainable
- (void)testLabelTextBeforeTextable
{
UILabel *label = UILabel.new;
label.textAndApplyChainable = @"Hello, world!";
label.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
label.bonString = @"Hello, world!";
label.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);

XCTAssertEqualObjects(label.attributedText.string, @"Hello, world!");

Expand All @@ -77,10 +77,10 @@ - (void)testLabelTextBeforeChainable
BONAssertAttributedStringHasAttributes(label.attributedText, controlAttributes);
}

- (void)testLabelAttributedTextAfterChainable
- (void)testLabelAttributedTextAfterTextable
{
UILabel *label = UILabel.new;
label.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
label.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);
label.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, world!"];

XCTAssertEqualObjects(label.attributedText.string, @"Hello, world!");
Expand All @@ -90,13 +90,13 @@ - (void)testLabelAttributedTextAfterChainable
BONAssertAttributedStringHasAttributes(label.attributedText, controlAttributes);
}

- (void)testLabelAttributedTextBeforeChainable
- (void)testLabelAttributedTextBeforeTextable
{
UILabel *label = UILabel.new;
label.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, world!"];
label.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
label.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);

XCTAssertNotNil(label.bonChainable);
XCTAssertNotNil(label.bonTextable);
XCTAssertEqualObjects(label.attributedText.string, @"Hello, world!");

NSParagraphStyle *defaultParagraphStyle = [[NSParagraphStyle alloc] init];
Expand All @@ -113,11 +113,11 @@ - (void)testLabelAttributedTextBeforeChainable

#pragma mark - UITextView

- (void)testTextViewTextAfterChainable
- (void)testTextViewTextAfterTextable
{
UITextView *textView = UITextView.new;
textView.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textView.textAndApplyChainable = @"Hello, world!";
textView.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);
textView.bonString = @"Hello, world!";

XCTAssertEqualObjects(textView.attributedText.string, @"Hello, world!");

Expand All @@ -133,11 +133,11 @@ - (void)testTextViewTextAfterChainable
BONAssertAttributedStringHasAttributes(textView.attributedText, controlAttributes);
}

- (void)testTextViewTextBeforeChainable
- (void)testTextViewTextBeforeTextable
{
UITextView *textView = UITextView.new;
textView.textAndApplyChainable = @"Hello, world!";
textView.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textView.bonString = @"Hello, world!";
textView.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);

XCTAssertEqualObjects(textView.attributedText.string, @"Hello, world!");

Expand All @@ -153,10 +153,10 @@ - (void)testTextViewTextBeforeChainable
BONAssertAttributedStringHasAttributes(textView.attributedText, controlAttributes);
}

- (void)testTextViewAttributedTextAfterChainable
- (void)testTextViewAttributedTextAfterTextable
{
UITextView *textView = UITextView.new;
textView.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textView.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);
textView.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, world!"];

XCTAssertEqualObjects(textView.attributedText.string, @"Hello, world!");
Expand All @@ -166,11 +166,11 @@ - (void)testTextViewAttributedTextAfterChainable
BONAssertAttributedStringHasAttributes(textView.attributedText, controlAttributes);
}

- (void)testTextViewAttributedTextBeforeChainable
- (void)testTextViewAttributedTextBeforeTextable
{
UITextView *textView = UITextView.new;
textView.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, world!"];
textView.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textView.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);

XCTAssertEqualObjects(textView.attributedText.string, @"Hello, world!");

Expand All @@ -188,11 +188,11 @@ - (void)testTextViewAttributedTextBeforeChainable

#pragma mark - UITextField

- (void)testTextFieldTextAfterChainable
- (void)testTextFieldTextAfterTextable
{
UITextField *textField = UITextField.new;
textField.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textField.textAndApplyChainable = @"Hello, world!";
textField.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);
textField.bonString = @"Hello, world!";

XCTAssertEqualObjects(textField.attributedText.string, @"Hello, world!");

Expand All @@ -206,11 +206,11 @@ - (void)testTextFieldTextAfterChainable
BONAssertAttributedStringHasAttributes(textField.attributedText, controlAttributes);
}

- (void)testTextFieldTextBeforeChainable
- (void)testTextFieldTextBeforeTextable
{
UITextField *textField = UITextField.new;
textField.textAndApplyChainable = @"Hello, world!";
textField.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textField.bonString = @"Hello, world!";
textField.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);

XCTAssertEqualObjects(textField.attributedText.string, @"Hello, world!");

Expand All @@ -224,10 +224,10 @@ - (void)testTextFieldTextBeforeChainable
BONAssertAttributedStringHasAttributes(textField.attributedText, controlAttributes);
}

- (void)testTextFieldAttributedTextAfterChainable
- (void)testTextFieldAttributedTextAfterTextable
{
UITextField *textField = UITextField.new;
textField.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textField.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);
textField.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, world!"];

XCTAssertEqualObjects(textField.attributedText.string, @"Hello, world!");
Expand All @@ -237,13 +237,13 @@ - (void)testTextFieldAttributedTextAfterChainable
BONAssertAttributedStringHasAttributes(textField.attributedText, controlAttributes);
}

- (void)testTextFieldAttributedTextBeforeChainable
- (void)testTextFieldAttributedTextBeforeTextable
{
UITextField *textField = UITextField.new;
textField.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, world!"];
textField.bonChainable = BONChain.new.font([UIFont systemFontOfSize:16]);
textField.bonTextable = BONChain.new.font([UIFont systemFontOfSize:16]);

XCTAssertNotNil(textField.bonChainable);
XCTAssertNotNil(textField.bonTextable);
XCTAssertEqualObjects(textField.attributedText.string, @"Hello, world!");

NSMutableDictionary *controlAttributes = BONDefaultAttributesForClassWithString([UITextField class], @"Hello, world!");
Expand Down
6 changes: 3 additions & 3 deletions Pod/Classes/BONChain.h
Expand Up @@ -43,7 +43,7 @@ typedef BONChain *BONCNonnull (^BONChainUnderlineColor)(UIColor *BONCNullable co
typedef BONChain *BONCNonnull (^BONChainStrikethroughStyle)(NSUnderlineStyle style);
typedef BONChain *BONCNonnull (^BONChainStrikethroughColor)(UIColor *BONCNullable color);

@interface BONChain : NSObject <NSCopying, BONChainable>
@interface BONChain : NSObject <BONTextable>

@property (copy, nonatomic, readonly) NSAttributedString *attributedString;
@property (copy, nonatomic, readonly) BONStringDict *attributes;
Expand Down Expand Up @@ -93,8 +93,8 @@ typedef BONChain *BONCNonnull (^BONChainStrikethroughColor)(UIColor *BONCNullabl
@property (copy, nonatomic, readonly) BONChainStrikethroughColor strikethroughColor;

// concatenation
- (void)appendLink:(id<BONChainable>)link;
- (void)appendLink:(id<BONChainable>)link separator:(BONNullable NSString *)separator;
- (void)appendLink:(id<BONTextable>)link;
- (void)appendLink:(id<BONTextable>)link separator:(BONNullable NSString *)separator;

@end

Expand Down
4 changes: 2 additions & 2 deletions Pod/Classes/BONChain.m
Expand Up @@ -342,12 +342,12 @@ - (BONChainStrikethroughColor)strikethroughColor
return [strikethroughColorBlock copy];
}

- (void)appendLink:(id<BONChainable>)link
- (void)appendLink:(id<BONTextable>)link
{
[self appendLink:link separator:nil];
}

- (void)appendLink:(id<BONChainable>)link separator:(NSString *)separator
- (void)appendLink:(id<BONTextable>)link separator:(NSString *)separator
{
if (separator.length > 0) {
// Recursion!
Expand Down
4 changes: 2 additions & 2 deletions Pod/Classes/BONText.h
Expand Up @@ -8,7 +8,7 @@

@import UIKit;

#import "BONChainable.h"
#import "BONTextable.h"
#import "BONCompatibility.h"

typedef NS_ENUM(NSUInteger, BONFigureCase) {
Expand All @@ -25,7 +25,7 @@ typedef NS_ENUM(NSUInteger, BONFigureSpacing) {

@class BONText;

@interface BONText : NSObject <NSCopying, BONChainable>
@interface BONText : NSObject <BONTextable>

// Appending

Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/BONText.m
Expand Up @@ -463,7 +463,7 @@ - (void)setImage:(UIImage *)image
}
}

#pragma mark - BONChainable
#pragma mark - BONTextable

- (BONText *)text
{
Expand Down
4 changes: 2 additions & 2 deletions Pod/Classes/BONChainable.h → Pod/Classes/BONTextable.h
@@ -1,5 +1,5 @@
//
// BONChainable.h
// BONTextable.h
// BonMot
//
// Created by Zev Eisenberg on 10/9/15.
Expand All @@ -17,7 +17,7 @@ BON_ASSUME_NONNULL_BEGIN
/**
* Objects conforming to this protocol can be used in BonMot chaining operations.
*/
@protocol BONChainable <NSObject>
@protocol BONTextable <NSObject, NSCopying>

@property (strong, nonatomic, readonly) BONText *text;

Expand Down
14 changes: 7 additions & 7 deletions Pod/UI/Classes/UILabel+BonMotUtilities.h
Expand Up @@ -7,21 +7,21 @@
//

@import UIKit;
@protocol BONChainable;

@protocol BONTextable;

@interface UILabel (BonMotUtilities)

/**
* Assign a @p BONChainable object to apply to the label text. When a new value is assigned to @p text the chain attributes will be applied.
* If a new value is assigned directly to @p attributedText the @p bonChainable property will be set to @p nil.
* Assign a @c BONTextable object to apply to the label text. When a new value is assigned to @c bonString the chain attributes will be applied.
*/
@property (copy, nonatomic) id<BONChainable> bonChainable;
@property (copy, nonatomic) id<BONTextable> bonTextable;

/**
* Assigning text via this method will apply the chain attributes and set the @p attributedText with the resulting @p NSAttributedString.
* Assigning a string via this method will apply the attributes of any assigned @c BONTextable and set the @c attributedText with the resulting @c NSAttributedString.
*
* @param text The text to be displayed.
* @param string The text to be displayed.
*/
- (void)setTextAndApplyChainable:(NSString *)text;
- (void)setBonString:(NSString *)string;

@end

0 comments on commit 882911a

Please sign in to comment.