Skip to content

Instantly share code, notes, and snippets.

View bdalziel's full-sized avatar

Ben Dalziel bdalziel

View GitHub Profile
-(void)wrangleData {
NSMutableArray *wrangledData = [[NSMutableArray alloc] init];
// Read model data into blocks and into wrangledData
// Communicate service state
switch (self.teamService.serviceState) {
case ASPServiceStatePreLoad :
@interface ASPFantasyHomeViewController ()
@property (nonatomic, strong) ASPFantasyHomeDataWrangler *dataWrangler;
@end
@implementation ASPFantasyHomeViewController
typedef NS_ENUM(NSUInteger, ASPWrangledDataBlockType)
{
ASPWrangledDataBlockTypeLoading,
ASPWrangledDataBlockTypeLoadError,
ASPWrangledDataBlockTypeNoData,
ASPWrangledDataBlockTypePlaceholder,
ASPWrangledDataBlockTypeCustom,
};
+ (void)registerLoadingLifecycleCellNibsForReuseIdentifiers:(UITableView *)tableView
{
[tableView registerNib:[UINib nibWithNibName:@"LoadingCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:ASPTableCellUtilLoadingCellName];
[tableView registerNib:[UINib nibWithNibName:@"LoadErrorCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:ASPTableCellUtilLoadErrorCellName];
[tableView registerNib:[UINib nibWithNibName:@"NoDataCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:ASPTableCellUtilNoDataCellName];
[tableView registerNib:[UINib nibWithNibName:@"PlaceholderCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:ASPTableCellUtilPlaceholderCellName];
}
@bdalziel
bdalziel / AppearanceManager.swift
Last active August 18, 2016 19:35
Relies on SwiftHEXColors for some nice UIColor extensions https://github.com/thii/SwiftHEXColors
//
// AppearanceManager.swift
//
// Created by Ben Dalziel on 2/17/16.
//
import UIKit
class AppearanceManager {
enum AppColors: String {
case Beige = "#f5efe0",
Gold = "#cda582",
FMLRed = "#fa463c",
BlackVelvet = "#1e0a14",
DarkVelvet = "#321e28",
Velvet = "#4a283e", //503146",
// Alternate colors - use sparingly
FMLRedAlt = "#e14137",
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
+ (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;
}
+ (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;