This file contains 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)setProgramaticConstraints { | |
self.myView = [UIView new]; | |
self.myView.translatesAutoresizingMaskIntoConstraints = NO; | |
[self.myView setBackgroundColor:COLOR_WHITE_SMOKE]; | |
[self.view addSubview:self.myView]; | |
[self.myView addConstraint:[NSLayoutConstraint constraintWithItem:self.myView | |
attribute:NSLayoutAttributeHeight | |
relatedBy:NSLayoutRelationEqual | |
toItem:nil |
This file contains 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
#define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) | |
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) | |
#define IS_IPHONE_4 (IS_IPHONE && ([[UIScreen mainScreen] bounds].size.height == 480.0) && ((IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale == [UIScreen mainScreen].scale) || !IS_OS_8_OR_LATER)) | |
#define IS_IPHONE_5 (IS_IPHONE && ([[UIScreen mainScreen] bounds].size.height == 568.0) && ((IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale == [UIScreen mainScreen].scale) || !IS_OS_8_OR_LATER)) | |
#define IS_STANDARD_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0 && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale == [UIScreen mainScreen].scale) | |
#define IS_ZOOMED_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0 && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale > [UIScreen mainScreen].scale) | |
#define IS_STANDA |
This file contains 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> | |
IB_DESIGNABLE //Reusable Views loaded from a xib file, you can see them on storyboard | |
@interface ReusableView : UIView | |
@property (weak, nonatomic) IBOutlet UILabel *message; | |
@end |
This file contains 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> | |
@interface NetworkManager : NSObject | |
+(NetworkManager*) sharedInstance; | |
-(void)callAPIWithParameters:(NSDictionary *)parameters andUrl:(NSString *)url andMethodType:(NSString *)methodType andCompletion:(void(^) (BOOL success, id response, NSString *message, NSError *error)) completion; | |
@end |
This file contains 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> | |
static NSString * const reusableCellIdentifier = @"reusableCell"; | |
@interface ReusableTableCell : UITableViewCell | |
@property (weak, nonatomic) IBOutlet UIImageView *reusableImageView; | |
@property (weak, nonatomic) IBOutlet UILabel *reusableLabel; | |
@end |
This file contains 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 | |
import Alamofire | |
class AccessTokenAdapter: RequestAdapter { | |
private let accessToken: String | |
init(accessToken: String) { | |
self.accessToken = accessToken | |
} | |
This file contains 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
#pragma mark - User Defaults | |
//Saves information on cache | |
+ (void)saveToUserDefault:(NSObject*)objectToSave withKey:(NSString*)key { | |
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | |
[userDefaults setObject:objectToSave forKey:key]; | |
[userDefaults synchronize]; | |
} | |
//Retrieves information from cache |
This file contains 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
DELEGATE METHODS CALLED WHEN OPENING APP | |
Opening app when system killed or user killed | |
didFinishLaunchingWithOptions | |
applicationDidBecomeActive | |
Opening app when backgrounded | |
applicationWillEnterForeground | |
applicationDidBecomeActive |
This file contains 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
let nonMutableProperty = "this content cannot change" | |
var mutableProperty = "this content can be changed" | |
mutableProperty = "changing variable content" |
This file contains 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
var optionalString: String? = nil | |
if let unwrappedOptionalWithIf = optionalString { | |
print("Use \(unwrappedOptionalWithIf) here") | |
} | |
func printString(string: String?) { | |
guard let unwrappedOptionalWithGuard = optionalString else { | |
print("Treat error") | |
return |
OlderNewer