Skip to content

Instantly share code, notes, and snippets.

View bdalziel's full-sized avatar

Ben Dalziel bdalziel

  • Slytrunk
  • Carlsbad, CA
View GitHub Profile
public indirect enum AppUIColors: Int {
case NavBarBackground,
NavBarTint,
NavBarShadow,
NavBarTitle,
PickerNavBarBackground,
PickerNavBarTint,
PickerNavBarTitle,
PickerNavBarTitleAlt,
class func uiColor(appUIColor: AppUIColors) -> UIColor {
switch appUIColor {
case .NavBarBackground,
.ViewControllerBackground: // References to color abbreviated
return color(AppColors.Beige)
case .ButtonTitleSelected,
.ButtonTitleHighlighted: // References to color abbreviated
return colorWithAlpha(AppColors.Beige, alpha: 0.7)
case .NavBarShadow,
.TableSeparator: // References to color abbreviated
//
// ColorUtil.swift
// FantasyMovieLeague
//
// Created by Ben Dalziel on 2/17/16.
// Copyright © 2016 Kinetoplay. All rights reserved.
//
import SwiftHEXColors
//
// FontUtil.swift
// FantasyMovieLeague
//
// Created by Ben Dalziel on 2/17/16.
// Copyright © 2016 Kinetoplay. All rights reserved.
//
import UIKit
+ (CGFloat)topUIBaselineAdjustment:(ASPUITextElement)element traitCollection:(UITraitCollection *)contextTraitCollection {
ASPUITextStyle elementTextStyle = [self mapUIElementToStyle:element];
UIFont *font = [ASPFontUtil getUIFont:elementTextStyle traitCollection:contextTraitCollection];
return floor(font.ascender - font.capHeight);
}
+ (CGFloat)bottomUIBaselineAdjustment:(ASPUITextElement)element traitCollection:(UITraitCollection *)contextTraitCollection {
ASPUITextStyle elementTextStyle = [self mapUIElementToStyle:element];
UIFont *font = [ASPFontUtil getUIFont:elementTextStyle traitCollection:contextTraitCollection];
return -(floor(font.lineHeight - font.ascender));
+ (CGFloat)getUIFontSize:(ASPUITextStyle)style traitCollection:(UITraitCollection *)contextTraitCollection {
bool isCompact = !(contextTraitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular);
CGFloat pointSize = (isCompact) ? 14.0f : 18.0f;
switch (style) {
case ASPUIElementStyleTitle1 :
pointSize = (isCompact) ? 36.0f : 36.0f;
break;
+ (CGFloat)getSpacing:(ASPSpacingSize)size traitCollection:(UITraitCollection *)contextTraitCollection {
bool isCompact = !(contextTraitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular);
switch (size) {
case ASPSpacingSizeTiny :
return (isCompact) ? 8.0f : 16.0f;
case ASPSpacingSizeSmall :
return (isCompact) ? 16.0f : 24.0f;
case ASPSpacingSizeLarge :
return (isCompact) ? 24.0f : 48.0f;
}
// https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITraitEnvironment_Ref/#//apple_ref/occ/intfm/UITraitEnvironment/traitCollectionDidChange:
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
[self handleMargins:self.traitCollection];
}
- (void)renderHeatIntoCell:(ASPFantasyPickemGame *)fantasyGame athleteId:(NSString *)athleteId eventId:(NSString *)eventId roundNumber:(NSString *)roundNumber rosterSlot:(NSString *)rosterSlot traitCollection:(UITraitCollection *)contextTraitCollection
typedef NS_ENUM(NSUInteger, ASPWrangledDataBlockType)
{
ASPWrangledDataBlockTypeLoading,
ASPWrangledDataBlockTypeLoadError,
ASPWrangledDataBlockTypeNoData,
ASPWrangledDataBlockTypePlaceholder,
ASPWrangledDataBlockTypeCustom,
};
@interface ASPFantasyHomeViewController ()
@property (nonatomic, strong) ASPFantasyHomeDataWrangler *dataWrangler;
@end
@implementation ASPFantasyHomeViewController