Skip to content

Instantly share code, notes, and snippets.

View GregoryMaks's full-sized avatar

Gregory Maksiuk GregoryMaks

View GitHub Profile
@GregoryMaks
GregoryMaks / Maybe.h
Created July 28, 2016 20:58 — forked from samwgoldman/Maybe.h
Maybe monad-alike in Objective-C using parts of ReactiveCocoa and libextobjc concrete protocols
#import <Foundation/Foundation.h>
#import <libextobjc/EXTConcreteProtocol.h>
@protocol Maybe <NSObject>
- (id<Maybe>)map:(id (^)(id value))block;
- (id<Maybe>)flattenMap:(id<Maybe> (^)(id value))block;
- (id<Maybe>)orElse:(id)defaultValue;
- (id)getOrElse:(id)defaultValue;
+ (UIImage *)launchImageWithPrefix:(NSString *)prefix interfaceOrientation:(UIInterfaceOrientation)orientation
{
NSString *imageName = nil;
// TODO.GregoryM: fillup rest of image names and check in different cases
CGFloat mainScreenHeight = CGRectGetHeight([UIScreen mainScreen].bounds);
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
if (mainScreenHeight == 568) {
imageName = UIInterfaceOrientationIsPortrait(orientation) ? @"-700-568h@2x.png" : nil;