Skip to content

Commit

Permalink
replaced typedef for DTColor/DTImage with @compatibility_alias
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Mar 21, 2012
1 parent 75502c9 commit a2940f1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 30 deletions.
3 changes: 1 addition & 2 deletions Core/Source/DTAttributedTextCell.m
Expand Up @@ -6,9 +6,8 @@
// Copyright 2011 Drobnik.com. All rights reserved. // Copyright 2011 Drobnik.com. All rights reserved.
// //


#import "DTCoreText.h"
#import "DTAttributedTextCell.h" #import "DTAttributedTextCell.h"
#import "DTAttributedTextContentView.h"
#import "DTColor+HTML.h"


@implementation DTAttributedTextCell @implementation DTAttributedTextCell
{ {
Expand Down
12 changes: 1 addition & 11 deletions Core/Source/DTAttributedTextContentView.m
Expand Up @@ -6,18 +6,8 @@
// Copyright 2011 Drobnik.com. All rights reserved. // Copyright 2011 Drobnik.com. All rights reserved.
// //


#import "DTCoreTextConstants.h"

#import "DTAttributedTextContentView.h" #import "DTAttributedTextContentView.h"
#import "DTAttributedTextView.h" #import "DTCoreText.h"
#import "DTCoreTextLayoutFrame.h"

#import "DTTextAttachment.h"
#import "NSString+HTML.h"
#import "DTColor+HTML.h"

#import "DTLinkButton.h"

#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>


#if !__has_feature(objc_arc) #if !__has_feature(objc_arc)
Expand Down
4 changes: 1 addition & 3 deletions Core/Source/DTAttributedTextView.m
Expand Up @@ -7,9 +7,7 @@
// //


#import "DTAttributedTextView.h" #import "DTAttributedTextView.h"
#import "DTAttributedTextContentView.h" #import "DTCoreText.h"

#import "DTColor+HTML.h"


@interface DTAttributedTextView () @interface DTAttributedTextView ()


Expand Down
4 changes: 0 additions & 4 deletions Core/Source/DTColor+HTML.h
Expand Up @@ -13,8 +13,6 @@
*/ */
@interface UIColor (HTML) @interface UIColor (HTML)


typedef UIColor DTColor;

/** /**
Takes a CSS color string ('333', 'F9FFF9'), determines the RGB values used, and returns a UIColor object of that color. Takes a CSS color string ('333', 'F9FFF9'), determines the RGB values used, and returns a UIColor object of that color.
For each part of the RGB color those numbers for that color are converted to a number using a category on NSString. Then that number is divided by the maximum value, 15 for 3 character strings and 255 for 6 character strings, making the color a percentage and within the range 0.0 and 1.0 that UIColor uses. For each part of the RGB color those numbers for that color are converted to a number using a category on NSString. Then that number is divided by the maximum value, 15 for 3 character strings and 255 for 6 character strings, making the color a percentage and within the range 0.0 and 1.0 that UIColor uses.
Expand Down Expand Up @@ -49,8 +47,6 @@ typedef UIColor DTColor;


#else #else


typedef NSColor DTColor;

/** /**
Methods used to work with HTML representations of colors. Methods used to work with HTML representations of colors.
*/ */
Expand Down
12 changes: 12 additions & 0 deletions Core/Source/DTCoreText.h
Expand Up @@ -6,9 +6,21 @@
#import "DTCoreTextConstants.h" #import "DTCoreTextConstants.h"


// DTColor is UIColor on iOS, NSColor on Mac // DTColor is UIColor on iOS, NSColor on Mac
#if TARGET_OS_IPHONE
@compatibility_alias DTColor UIColor;
#else
@compatibility_alias DTColor NSColor;
#endif

#import "DTColor+HTML.h" #import "DTColor+HTML.h"


// DTImage is UIImage on iOS, NSImage on Mac // DTImage is UIImage on iOS, NSImage on Mac
#if TARGET_OS_IPHONE
@compatibility_alias DTImage UIImage;
#else
@compatibility_alias DTImage NSImage;
#endif

#import "DTImage+HTML.h" #import "DTImage+HTML.h"


// DTEdgeInsets is UIEdgeInsets on iOS, NSEdgeInsets on Mac // DTEdgeInsets is UIEdgeInsets on iOS, NSEdgeInsets on Mac
Expand Down
12 changes: 7 additions & 5 deletions Core/Source/DTImage+HTML.h
@@ -1,9 +1,13 @@

//
// DTImage+HTML.h
// CoreTextExtensions
//
// Created by Oliver Drobnik on 1/9/11.
// Copyright 2011 Drobnik.com. All rights reserved.
//


#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE


typedef UIImage DTImage;

/** /**
Category used to have the same method available for unit testing on Mac on iOS. Category used to have the same method available for unit testing on Mac on iOS.
*/ */
Expand All @@ -20,8 +24,6 @@ typedef UIImage DTImage;


#else #else


typedef NSImage DTImage;

/** /**
Category used to have the same method available for unit testing on Mac on iOS. Category used to have the same method available for unit testing on Mac on iOS.
*/ */
Expand Down
6 changes: 1 addition & 5 deletions Core/Source/DTTextAttachment.m
Expand Up @@ -7,12 +7,8 @@
// //


#import "DTTextAttachment.h" #import "DTTextAttachment.h"
#import "DTHTMLElement.h" #import "DTCoreText.h"
#import "CGUtils.h"
#import "NSAttributedString+HTML.h"
#import "NSData+DTBase64.h" #import "NSData+DTBase64.h"
#import "DTImage+HTML.h"
#import "DTCoreTextConstants.h"


@implementation DTTextAttachment @implementation DTTextAttachment
{ {
Expand Down

0 comments on commit a2940f1

Please sign in to comment.