This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Preferences: class { | |
var showNames: Bool { get set } | |
func registerDefaults(registrar: Preferences -> Void) | |
} | |
private class DefaultPreferenceValues: Preferences { | |
var showNames = false | |
func registerDefaults(registrar: Preferences -> Void) { | |
fatalError("The registrar cannot register defaults") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GBClock { | |
var referenceDate = NSDate(timeIntervalSinceReferenceDate: 0) | |
var referenceDateInterval: NSTimeInterval { referenceDate.timeIntervalSinceReferenceDate } | |
func currentTime() → NSDate { | |
return NSDate(timeIntervalSinceNow: referenceDateInterval) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ListViewController.swift | |
// welbe | |
// | |
// Created by Ben Norris on 12/3/15. | |
// Copyright © 2015 O.C. Tanner Corporation. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CustomTabBar.swift | |
// welbe | |
// | |
// Created by Ben Norris on 12/8/15. | |
// Copyright © 2015 O.C. Tanner Corporation. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "Event Response", | |
"type": "object", | |
"properties": { | |
"id": { | |
"description": "Unique identifier for an event", | |
"type": "integer" | |
}, | |
"title": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity { | |
CGFloat offsetAdjustment = MAXFLOAT; | |
CGFloat horizontalCenter = proposedContentOffset.x + (CGRectGetWidth(self.collectionView.bounds) / 2.0); | |
CGRect targetRect = CGRectMake(proposedContentOffset.x, 0.0, self.collectionView.bounds.size.width, self.collectionView.bounds.size.height); | |
NSArray *attributesArray = [super layoutAttributesForElementsInRect:targetRect]; | |
for (UICollectionViewLayoutAttributes *layoutAttributes in attributesArray) { | |
CGFloat itemHorizontalCenter = layoutAttributes.center.x; | |
if (ABS(itemHorizontalCenter - horizontalCenter) < ABS(offsetAdjustment)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FillingSegmentedCircleView.h | |
// Created by Ben Norris on 2/20/15. | |
// Copyright (c) 2015 BSN Design. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface FillingSegmentedCircleView : UIView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <CoreData/CoreData.h> | |
@interface DXListTableViewDataSource : NSObject <UITableViewDataSource> | |
@property (nonatomic, strong) NSFetchedResultsController *fetchedResultsController; | |
- (void)registerTableView:(UITableView *)tableView; | |
- (void)configureFetchedResultsControllerForTableView:(UITableView *)tableView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSDictionary *)getMultipleValuesForPerson:(ABRecordRef)person forProperty:(ABPropertyID)property sanitizeToNumbers:(BOOL)sanitize { | |
NSMutableDictionary *mutableValuesWithLabels = [NSMutableDictionary dictionary]; | |
ABMultiValueRef values = ABRecordCopyValue(person, property); | |
if (values && ABMultiValueGetCount(values) > 0) | |
{ | |
for (CFIndex index = 0; index < ABMultiValueGetCount(values); index++) { | |
NSString *label = CFBridgingRelease(ABMultiValueCopyLabelAtIndex(values, index)); | |
NSString *value = CFBridgingRelease(ABMultiValueCopyValueAtIndex(values, index)); | |
if (sanitize) { | |
value = [[value componentsSeparatedByCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]] componentsJoinedByString:@""]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setUpBottomToolbar { | |
self.navigationController.toolbar.tintColor = [UIColor orangeColor]; | |
self.navigationController.toolbarHidden = NO; | |
self.viewPlayOrHistory = [[UISegmentedControl alloc] initWithItems:@[@"Standard", @"History"]]; | |
self.viewPlayOrHistory.selectedSegmentIndex = 0; | |
UIBarButtonItem *viewSwitchButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.viewPlayOrHistory]; | |
[self.viewPlayOrHistory addTarget:self action:@selector(switchViewToPlayOrHistory) forControlEvents:UIControlEventValueChanged]; | |
UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; |