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 | |
struct Bakery { | |
func bakeBread() { | |
print("make some Bread") | |
} | |
} | |
struct Kitchen { | |
func cookPizza() { |
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 | |
enum ComputerModel: String { | |
case apple = "Apple" | |
case windows = "Windows" | |
case linux = "Linux" | |
} | |
enum ComputerError: Error { | |
case tooEarly |
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 | |
struct Ingredient { | |
var name: String | |
var amount: Double | |
} | |
protocol Cookable { | |
func cook() | |
} |
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
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
[[EDAConnectionManager sharedManager] getQuestionsWithSuccess:^(NSArray *questions) { | |
self.questions = questions; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self.refreshControl endRefreshing]; | |
[self.tableView reloadData]; | |
}); | |
}failure:^(NSError *error) { | |
NSLog(@"error: %@", [error localizedDescription]); | |
}]; |
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) updateCountdown { | |
NSTimeInterval timeToClosing = [_deleteDate timeIntervalSinceDate:[NSDate date]]; | |
div_t h = div(timeToClosing, 3600); | |
int hours = h.quot; | |
div_t m = div(h.rem, 60); | |
int minutes = m.quot; | |
int seconds = m.rem; | |
NSString *hoursStr, *minutesStr, *secondsStr; |
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)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
CGFloat xOffset = _scrollView.contentOffset.x; | |
CGFloat newStart = 0; | |
BOOL done = NO; | |
NSInteger newIndex = 1; | |
while (done == NO) { | |
if (newStart + 320 < xOffset) { | |
newStart += 320; | |
newIndex++; |
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
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *cellIdentifier = @"AfterpartyPhotoCell"; | |
AfterpartyPhotoCell *cell = (AfterpartyPhotoCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath]; | |
if (!cell) | |
cell = [[AfterpartyPhotoCell alloc] init]; | |
[cell.downloadIndicator startAnimating]; | |
cell.downloadIndicator.center = cell.center; | |
cell.imageView.contentMode = UIViewContentModeScaleAspectFill; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ |