Skip to content

Instantly share code, notes, and snippets.

Thiago Lioy thiagolioy

Block or report user

Report or block thiagolioy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thiagolioy
thiagolioy / ApiClient.h
Last active Aug 29, 2015
ViewController Tests Example with Specta Expecta OCMock
View ApiClient.h
typedef void (^CompletionBlock)(NSArray *results);
@interface ApiClient : NSObject
-(void)fetchCatalog:(CompletionBlock)block;
@end
@implementation ApiClient
@thiagolioy
thiagolioy / Fastfile.rb
Last active Aug 29, 2015
Fastfile with tests , coverage and deploy
View Fastfile.rb
fastlane_version "1.0.2"
default_platform :ios
platform :ios do
before_all do
cocoapods
@thiagolioy
thiagolioy / SessionManagerSpec.m
Created Jun 11, 2015
How to use Specta, Expecta and OCMock . With ViewControllers and Helper|Utility Classes
View SessionManagerSpec.m
#import <UIKit/UIKit.h>
#import <Specta.h>
#import <Expecta.h>
#import <OCMock.h>
#import "SessionManager.h"
SpecBegin(SessionManagerSpec)
@thiagolioy
thiagolioy / EnvironmentUtil.m
Created Jun 15, 2015
DBEnvironmentConfiguration example
View EnvironmentUtil.m
#import "EnvironmentUtil.h"
#import <DBEnvironmentConfiguration/DBEnvironmentConfiguration.h>
@implementation EnvironmentUtil
+(void)setupEnvironmentMappings{
[DBEnvironmentConfiguration setEnvironmentMapping:@{
[NSNumber numberWithInt:DBBuildTypeSimulator] : @"Staging",
[NSNumber numberWithInt:DBBuildTypeDebug] : @"Staging",
@thiagolioy
thiagolioy / mocking_view_controller_methods.m
Last active Aug 29, 2015
Testing Mocking blocks response
View mocking_view_controller_methods.m
__block HomeViewController *vc;
beforeAll(^{
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *controller = [mainStoryboard instantiateViewControllerWithIdentifier:@"HomeViewController"];
vc = (HomeViewController *)(controller);
[vc view];
});
View parse.m
+(NSDictionary*)parse:(NSDictionary*)dc{
NSMutableDictionary *mutDc = [NSMutableDictionary dictionaryWithDictionary:dc];
for(NSString *key in mutDc.allKeys){
NSString *value = [mutDc objectForKey:key];
if([value isEqualToString:@"true"])
[mutDc setObject:@YES forKey:key];
else if([value isEqualToString:@"false"])
[mutDc setObject:@NO forKey:key];
}
@thiagolioy
thiagolioy / parse.m
Created Dec 6, 2015
Bricks! Mantle parse
View parse.m
@interface BKBaseMantleObj : MTLModel<MTLJSONSerializing>
+ (NSDictionary *)JSONKeyPathsByPropertyKey;
+(instancetype)parse:(NSDictionary*)dc error:(NSError**)error;
-(NSDictionary*)asDictError:(NSError**)error;
@end
@interface BKBaseMantleObj (Collections)
View MarvelAPI.swift
import Foundation
import Moya
import CryptoSwift
import Dollar
import Keys
fileprivate struct MarvelAPIConfig {
fileprivate static let keys = MarvelKeys()
static let privatekey = keys.marvelPrivateKey()!
static let apikey = keys.marvelApiKey()!
@thiagolioy
thiagolioy / Podfile
Created Nov 21, 2016
MarvelApp podfile
View Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Marvel' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
plugin 'cocoapods-keys', {
:project => "Marvel",
:keys => [
View MarvelAPIManager.swift
import Foundation
import Moya
import RxSwift
import ObjectMapper
import Moya_ObjectMapper
extension Response {
func removeAPIWrappers() -> Response {
guard let json = try? self.mapJSON() as? Dictionary<String, AnyObject>,
let results = json?["data"]?["results"] ?? [],
You can’t perform that action at this time.