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 UIKit | |
import WebKit | |
final class ReCAPTCHAViewController: UIViewController { | |
private var webView: WKWebView! | |
private let viewModel: ReCAPTCHAViewModel | |
init(viewModel: ReCAPTCHAViewModel) { | |
self.viewModel = viewModel |
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
//Taken from and used with: | |
// http://stackoverflow.com/questions/16663618/async-image-loading-from-url-inside-a-uitableview-cell-image-changes-to-wrong | |
//////////////////// | |
//With SDWebImage // | |
//////////////////// | |
(don't use the below method. This one is king.) | |
//Import the goods and use PODS | |
// pod 'SDWebImage', '~> 3.7' |
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
@implementation XYZBlockKeeper | |
- (void)configureBlock { | |
self.block = ^{ | |
[self doSomething]; // capturing a strong reference to self | |
// creates a strong reference cycle | |
}; | |
} | |
... | |
@end |
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
// Given `notes` contains an array of Note objects | |
//Archive | |
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:notes]; | |
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"notes"]; | |
//Unarchive | |
NSData *notesData = [[NSUserDefaults standardUserDefaults] objectForKey:@"notes"]; | |
NSArray *notes = [NSKeyedUnarchiver unarchiveObjectWithData:notesData]; |
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
//GOOGLE GEOCODING | |
//Get Address String from Google API CLLocation Lat/Lon | |
-(void) googleReverseGeocode :(CLLocation *)location { | |
[[GMSGeocoder geocoder] reverseGeocodeCoordinate:location.coordinate completionHandler: | |
^(GMSReverseGeocodeResponse *response, NSError *error){ | |
if (error) { |
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
.h = - (void)signInAccountWithUserName:(NSString *)userName | |
password:(NSString *)password | |
completion:(void (^)(BOOL success))completionBlock; | |
.m = - (void)signInAccountWithUserName:(NSString *)userName | |
password:(NSString *)password | |
completion:(void (^)(BOOL success))completionBlock | |
{ | |
// Notice that we are passing a BOOL back to the completion block. | |
if (completionBlock != nil) completionBlock(loginSuccessful); |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Override point for customization after application launch. | |
[GMSServices provideAPIKey:@"AIzaSyAZWKELBYsRrFTjmd572Wh2iLpB92tZH2o"]; | |
// self.dynamicsController = drawerVC; | |
// self.window.rootViewController = self.dynamicsController; | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
WelcomeViewController *welcomeVC = [WelcomeViewController new]; |
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 <UIKit/UIKit.h> | |
#import <CoreData/CoreData.h> | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; | |
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; | |
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; |
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
// Return all languages set in app | |
// The first language is NULL (?) | |
-(NSMutableArray*)getLanguages { | |
NSArray *languageArr = [[NSBundle mainBundle] localizations]; | |
for ( int i=1; i<[languageArr count]; i++) { | |
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en"]; | |
NSString *lang = [locale displayNameForKey:NSLocaleIdentifier value:[languageArr objectAtIndex:i]]; | |
[self.languageArray addObject:lang]; | |
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> | |
#define RUNTIME_LANGUAGE_STORAGE @"runtimeLanguageStorage" | |
#define RunTimeLanguageEnglish @"en" | |
#define RunTimeLanguageSpanish @"es-MX" | |
#undef NSLocalizedString | |
#define NSLocalizedString(key, comment) [[NSBundle mainBundle] runTimeLocalizedStringForKey:(key) value:@"" table:nil] | |
#define setLanguage(x) [[NSUserDefaults standardUserDefaults] setObject:x forKey:RUNTIME_LANGUAGE_STORAGE]; [[NSUserDefaults standardUserDefaults] synchronize]; |
NewerOlder