Commit a8ae05e0 by Gabriel O'Flaherty-Chan

Merge pull request #173 from Shopify/task/move-classes-into-sample-apps

Adds deleted View Controllers to Advanced Sample App
parents 64c93afb 41513430
//
// BUYImageKit.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import Foundation;
@import UIKit;
/**
* Image generator for a variety of images using the BUYProductViewController.
*/
@interface BUYImageKit : NSObject
/**
* Generates a close button image for the variant selection navigation bar.
*
* @param frame The frame size of the image
*
* @return A close button image
*/
+ (UIImage*)imageOfVariantCloseImageWithFrame: (CGRect)frame;
/**
* Generates a checkmark image for use of displaying the previously selected variant
*
* @param frame The frame size of the image
*
* @return A checkmark for the previous variant selection
*/
+ (UIImage*)imageOfPreviousSelectionIndicatorImageWithFrame: (CGRect)frame;
/**
* Generates a custom disclosure indicator image
*
* @param frame The frame size of the image
* @param color The color for the disclosure indicator
*
* @return A disclusore indicator image
*/
+ (UIImage*)imageOfDisclosureIndicatorImageWithFrame: (CGRect)frame color:(UIColor*)color;
/**
* Generates a close button image for the product view's navigation bar
*
* @param frame The frame size of the image
* @param color The color for the close button image
* @param hasShadow True if the X should have a drop shadow
*
* @return A close button image
*/
+ (UIImage*)imageOfProductViewCloseImageWithFrame: (CGRect)frame color:(UIColor*)color hasShadow:(BOOL)hasShadow;
/**
* Generates a custom back button image for the variant selection navigation bar
*
* @param frame The frame size of the image
*
* @return A custom back button image
*/
+ (UIImage*)imageOfVariantBackImageWithFrame: (CGRect)frame;
@end
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
// //
#import "Theme+Additions.h" #import "Theme+Additions.h"
#import "UIFont+BUYAdditions.h" #import "UIFont+Additions.h"
#import "UIColor+BUYAdditions.h" #import "UIColor+Additions.h"
@implementation Theme (Additions) @implementation Theme (Additions)
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#import "Theme+Additions.h" #import "Theme+Additions.h"
#import "VariantOptionView.h" #import "VariantOptionView.h"
#import "VisualEffectView.h" #import "VisualEffectView.h"
#import "UIColor+BUYAdditions.h" #import "UIColor+Additions.h"
#import "CheckoutButton.h" #import "CheckoutButton.h"
@implementation Theme @implementation Theme
......
//
// BUYPaymentButton.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
typedef NS_ENUM(NSInteger, BUYPaymentButtonStyle) {
BUYPaymentButtonStyleWhite = 0,
BUYPaymentButtonStyleWhiteOutline,
BUYPaymentButtonStyleBlack
};
typedef NS_ENUM(NSInteger, BUYPaymentButtonType) {
BUYPaymentButtonTypePlain = 0,
BUYPaymentButtonTypeBuy,
BUYPaymentButtonTypeSetup NS_ENUM_AVAILABLE_IOS(9_0)
};
@interface BUYPaymentButton : UIButton
+ (instancetype)buttonWithType:(BUYPaymentButtonType)buttonType style:(BUYPaymentButtonStyle)buttonStyle;
@end
// //
// BUYPaymentButton.h // PaymentButton.h
// Mobile Buy SDK // Mobile Buy SDK
// //
// Created by Shopify. // Created by Shopify.
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
// THE SOFTWARE. // THE SOFTWARE.
// //
typedef NS_ENUM(NSInteger, BUYPaymentButtonStyle) { typedef NS_ENUM(NSInteger, PaymentButtonStyle) {
BUYPaymentButtonStyleWhite = 0, PaymentButtonStyleWhite = 0,
BUYPaymentButtonStyleWhiteOutline, PaymentButtonStyleWhiteOutline,
BUYPaymentButtonStyleBlack PaymentButtonStyleBlack
}; };
typedef NS_ENUM(NSInteger, BUYPaymentButtonType) { typedef NS_ENUM(NSInteger, PaymentButtonType) {
BUYPaymentButtonTypePlain = 0, PaymentButtonTypePlain = 0,
BUYPaymentButtonTypeBuy, PaymentButtonTypeBuy,
BUYPaymentButtonTypeSetup NS_ENUM_AVAILABLE_IOS(9_0) PaymentButtonTypeSetup NS_ENUM_AVAILABLE_IOS(9_0)
}; };
@interface BUYPaymentButton : UIButton @interface PaymentButton : UIButton
+ (instancetype)buttonWithType:(BUYPaymentButtonType)buttonType style:(BUYPaymentButtonStyle)buttonStyle; + (instancetype)buttonWithType:(PaymentButtonType)buttonType style:(PaymentButtonStyle)buttonStyle;
@end @end
// //
// BUYPaymentButton.m // PaymentButton.m
// Mobile Buy SDK // Mobile Buy SDK
// //
// Created by Shopify. // Created by Shopify.
...@@ -25,25 +25,25 @@ ...@@ -25,25 +25,25 @@
// //
@import PassKit; @import PassKit;
#import "BUYPaymentButton.h" #import "PaymentButton.h"
@interface BUYCustomPaymentButton : UIButton @interface CustomPaymentButton : UIButton
@property (nonatomic, assign) BUYPaymentButtonType customButtonType; @property (nonatomic, assign) PaymentButtonType customButtonType;
@property (nonatomic, assign) BUYPaymentButtonStyle customButtonStyle; @property (nonatomic, assign) PaymentButtonStyle customButtonStyle;
- (void)buttonWithType:(BUYPaymentButtonType)customButtonType style:(BUYPaymentButtonStyle)customButtonStyle; - (void)buttonWithType:(PaymentButtonType)customButtonType style:(PaymentButtonStyle)customButtonStyle;
@end @end
@implementation BUYCustomPaymentButton @implementation CustomPaymentButton
- (void)buttonWithType:(BUYPaymentButtonType)customButtonType style:(BUYPaymentButtonStyle)customButtonStyle { - (void)buttonWithType:(PaymentButtonType)customButtonType style:(PaymentButtonStyle)customButtonStyle {
self.customButtonType = customButtonType; self.customButtonType = customButtonType;
self.customButtonStyle = customButtonStyle; self.customButtonStyle = customButtonStyle;
self.layer.cornerRadius = 6; self.layer.cornerRadius = 6;
self.clipsToBounds = YES; self.clipsToBounds = YES;
if (self.customButtonStyle == BUYPaymentButtonStyleWhiteOutline) { if (self.customButtonStyle == PaymentButtonStyleWhiteOutline) {
self.layer.borderColor = [[UIColor blackColor] CGColor]; self.layer.borderColor = [[UIColor blackColor] CGColor];
self.layer.borderWidth = 1; self.layer.borderWidth = 1;
} }
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
UIColor *backgroundColor = [UIColor whiteColor]; UIColor *backgroundColor = [UIColor whiteColor];
UIColor *foregroundColor = [UIColor blackColor]; UIColor *foregroundColor = [UIColor blackColor];
if (self.customButtonStyle == BUYPaymentButtonStyleBlack) { if (self.customButtonStyle == PaymentButtonStyleBlack) {
backgroundColor = [UIColor blackColor]; backgroundColor = [UIColor blackColor];
foregroundColor = [UIColor whiteColor]; foregroundColor = [UIColor whiteColor];
} }
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
[foregroundColor setFill]; [foregroundColor setFill];
switch (self.customButtonType) { switch (self.customButtonType) {
case BUYPaymentButtonTypeBuy: { case PaymentButtonTypeBuy: {
//// Subframes //// Subframes
CGRect buyWithApplyPay = CGRectMake(CGRectGetMinX(frame) + (CGRectGetWidth(frame) * 0.09790f + 0.5f), CGRectGetMinY(frame) + (CGRectGetHeight(frame) * 0.25000f - 0.32f) + 0.82f, (CGRectGetWidth(frame) * 0.89055f + 0.15f) - (CGRectGetWidth(frame) * 0.09790f + 0.5f) + 0.35f, (CGRectGetHeight(frame) * 0.75414f + 0.5f) - (CGRectGetHeight(frame) * 0.25000f - 0.32f) - 0.82f); CGRect buyWithApplyPay = CGRectMake(CGRectGetMinX(frame) + (CGRectGetWidth(frame) * 0.09790f + 0.5f), CGRectGetMinY(frame) + (CGRectGetHeight(frame) * 0.25000f - 0.32f) + 0.82f, (CGRectGetWidth(frame) * 0.89055f + 0.15f) - (CGRectGetWidth(frame) * 0.09790f + 0.5f) + 0.35f, (CGRectGetHeight(frame) * 0.75414f + 0.5f) - (CGRectGetHeight(frame) * 0.25000f - 0.32f) - 0.82f);
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
} }
} }
break; break;
case BUYPaymentButtonTypePlain: { case PaymentButtonTypePlain: {
//// applePay Drawing //// applePay Drawing
UIBezierPath* applePayPath = UIBezierPath.bezierPath; UIBezierPath* applePayPath = UIBezierPath.bezierPath;
[applePayPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.65968f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.37344f * CGRectGetHeight(frame))]; [applePayPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.65968f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.37344f * CGRectGetHeight(frame))];
...@@ -569,17 +569,17 @@ ...@@ -569,17 +569,17 @@
@end @end
@implementation BUYPaymentButton @implementation PaymentButton
+ (instancetype)buttonWithType:(BUYPaymentButtonType)buttonType style:(BUYPaymentButtonStyle)buttonStyle { + (instancetype)buttonWithType:(PaymentButtonType)buttonType style:(PaymentButtonStyle)buttonStyle {
Class ApplePayButton = NSClassFromString(@"PKPaymentButton"); Class ApplePayButton = NSClassFromString(@"PKPaymentButton");
if (ApplePayButton) { if (ApplePayButton) {
return (BUYPaymentButton*)[ApplePayButton buttonWithType:buttonType return (PaymentButton*)[ApplePayButton buttonWithType:buttonType
style:buttonStyle]; style:buttonStyle];
} else { } else {
BUYCustomPaymentButton *customPaymentButton = [BUYCustomPaymentButton buttonWithType:UIButtonTypeCustom]; CustomPaymentButton *customPaymentButton = [CustomPaymentButton buttonWithType:UIButtonTypeCustom];
[customPaymentButton buttonWithType:buttonType style:buttonStyle]; [customPaymentButton buttonWithType:buttonType style:buttonStyle];
return (BUYPaymentButton*)customPaymentButton; return (PaymentButton*)customPaymentButton;
} }
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
@import PassKit; @import PassKit;
#import "CheckoutButton.h" #import "CheckoutButton.h"
#import "UIImage+BUYAdditions.h" #import "UIImage+Additions.h"
#import "UIImage+PaymentButton.h" #import "UIImage+PaymentButton.h"
#import "UIButton+PaymentButton.h" #import "UIButton+PaymentButton.h"
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
// //
#import "CheckoutButton.h" #import "CheckoutButton.h"
#import "UIColor+BUYAdditions.h" #import "UIColor+Additions.h"
#import "UIImage+BUYAdditions.h" #import "UIImage+Additions.h"
@interface CheckoutButton () @interface CheckoutButton ()
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// //
#import "ProductHeaderCell.h" #import "ProductHeaderCell.h"
#import "UIFont+BUYAdditions.h" #import "UIFont+Additions.h"
#import "Theme+Additions.h" #import "Theme+Additions.h"
@interface ProductHeaderCell () @interface ProductHeaderCell ()
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#import "Theme+Additions.h" #import "Theme+Additions.h"
#import "VariantOptionView.h" #import "VariantOptionView.h"
#import "UIFont+BUYAdditions.h" #import "UIFont+Additions.h"
@interface VariantOptionView () @interface VariantOptionView ()
......
// //
// UIColor+BUYAdditions.h // UIColor+Additions.h
// Mobile Buy SDK // Mobile Buy SDK
// //
// Created by Shopify. // Created by Shopify.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define BUY_RGB(r, g, b) BUY_RGBA(r, g, b, 1) #define BUY_RGB(r, g, b) BUY_RGBA(r, g, b, 1)
#define BUY_RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a] #define BUY_RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
@interface UIColor (BUYAdditions) @interface UIColor (Additions)
/** /**
* Check if the color is light (brightness of colors combined less than .5) * Check if the color is light (brightness of colors combined less than .5)
......
// //
// UIColor+BUYAdditions.m // UIColor+Additions.m
// Mobile Buy SDK // Mobile Buy SDK
// //
// Created by Shopify. // Created by Shopify.
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
// THE SOFTWARE. // THE SOFTWARE.
// //
#import "UIColor+BUYAdditions.h" #import "UIColor+Additions.h"
@implementation UIColor (BUYAdditions) @implementation UIColor (Additions)
-(BOOL)isLightColor -(BOOL)isLightColor
{ {
......
// //
// BUYFont.h // Font+Additions.h
// Mobile Buy SDK // Mobile Buy SDK
// //
// Created by Shopify. // Created by Shopify.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
@import UIKit; @import UIKit;
@interface UIFont (BUYAdditions) @interface UIFont (Additions)
/** /**
* Class method to allow system fonts to have increased point sizes from the OS default. * Class method to allow system fonts to have increased point sizes from the OS default.
......
// //
// BUYFont.m // BUYFont+Additions.m
// Mobile Buy SDK // Mobile Buy SDK
// //
// Created by Shopify. // Created by Shopify.
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
// THE SOFTWARE. // THE SOFTWARE.
// //
#import "UIFont+BUYAdditions.h" #import "UIFont+Additions.h"
@implementation UIFont (BUYAdditions) @implementation UIFont (Additions)
+ (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size + (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size
{ {
......
//
// BUYFont.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import UIKit;
@interface UIFont (BUYAdditions)
/**
* Class method to allow system fonts to have increased point sizes from the OS default.
*
* @param style The text style for the font.
* @param size A positive value to increase the default font's point size by.
*
* @return A system font with an optionally increased point size.
*/
+ (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size;
@end
//
// BUYFont.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "UIFont+BUYAdditions.h"
@implementation UIFont (BUYAdditions)
+ (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size
{
UIFontDescriptor *descriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:style];
return [UIFont fontWithDescriptor:descriptor size:descriptor.pointSize + size];
}
@end
// //
// UIImage+BUYAdditions.h // UIImage+Additions.h
// Mobile Buy SDK // Mobile Buy SDK
// //
// Created by Shopify. // Created by Shopify.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface UIImage (BUYAdditions) @interface UIImage (Additions)
+ (UIImage *)templateButtonBackgroundImage; + (UIImage *)templateButtonBackgroundImage;
+ (UIImage *)templateImageWithFill:(UIColor *)fill stroke:(UIColor *)stroke edgeInsets:(UIEdgeInsets)edgeInsets; + (UIImage *)templateImageWithFill:(UIColor *)fill stroke:(UIColor *)stroke edgeInsets:(UIEdgeInsets)edgeInsets;
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
// THE SOFTWARE. // THE SOFTWARE.
// //
#import "UIImage+BUYAdditions.h" #import "UIImage+Additions.h"
static const CGFloat kDefaultCornerRadius = 4.0f; static const CGFloat kDefaultCornerRadius = 4.0f;
static const CGFloat kDefaultStrokWidth = 1.0f; static const CGFloat kDefaultStrokWidth = 1.0f;
@implementation UIImage (BUYAdditions) @implementation UIImage (Additions)
+ (UIImage *)templateButtonBackgroundImage + (UIImage *)templateButtonBackgroundImage
{ {
......
//
// BUYImageKit.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import Foundation;
@import UIKit;
/**
* Image generator for a variety of images using the BUYProductViewController.
*/
@interface BUYImageKit : NSObject
/**
* Generates a close button image for the variant selection navigation bar.
*
* @param frame The frame size of the image
*
* @return A close button image
*/
+ (UIImage*)imageOfVariantCloseImageWithFrame: (CGRect)frame;
/**
* Generates a checkmark image for use of displaying the previously selected variant
*
* @param frame The frame size of the image
*
* @return A checkmark for the previous variant selection
*/
+ (UIImage*)imageOfPreviousSelectionIndicatorImageWithFrame: (CGRect)frame;
/**
* Generates a custom disclosure indicator image
*
* @param frame The frame size of the image
* @param color The color for the disclosure indicator
*
* @return A disclusore indicator image
*/
+ (UIImage*)imageOfDisclosureIndicatorImageWithFrame: (CGRect)frame color:(UIColor*)color;
/**
* Generates a close button image for the product view's navigation bar
*
* @param frame The frame size of the image
* @param color The color for the close button image
* @param hasShadow True if the X should have a drop shadow
*
* @return A close button image
*/
+ (UIImage*)imageOfProductViewCloseImageWithFrame: (CGRect)frame color:(UIColor*)color hasShadow:(BOOL)hasShadow;
/**
* Generates a custom back button image for the variant selection navigation bar
*
* @param frame The frame size of the image
*
* @return A custom back button image
*/
+ (UIImage*)imageOfVariantBackImageWithFrame: (CGRect)frame;
@end
//
// BUYFont.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
@import UIKit;
@interface UIFont (BUYAdditions)
/**
* Class method to allow system fonts to have increased point sizes from the OS default.
*
* @param style The text style for the font.
* @param size A positive value to increase the default font's point size by.
*
* @return A system font with an optionally increased point size.
*/
+ (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size;
@end
//
// BUYFont.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "UIFont+BUYAdditions.h"
@implementation UIFont (BUYAdditions)
+ (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size
{
UIFontDescriptor *descriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:style];
return [UIFont fontWithDescriptor:descriptor size:descriptor.pointSize + size];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment