Last active
December 23, 2015 15:47
-
-
Save mthongvanh/dcc11f3ded182357b751 to your computer and use it in GitHub Desktop.
Xcode Snippets
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
Debug Log Statement | |
---------------------- | |
DLog(@"\n<#debugging message#> <#%@#>",<#args#>); | |
NSString Convenience Method | |
---------------------------- | |
[NSString stringWithFormat:@"<#%@#>",<#args#>] | |
Dispatch Asynchronously on Main Queue | |
------------------------------------- | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
<#code#> | |
}); |
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
Perform Delegate Check | |
---------------------- | |
if (<#self.delegate#> && [<#self.delegate#> respondsToSelector:@selector(<#selector#>)]) | |
{ | |
[<#self.delegate#> <#selector#>]; | |
} | |
else | |
{ | |
<#NSLog#><#DLog#>(@"<#text#>",<#args#>); | |
} |
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
Custom Interface Property | |
---------------------- | |
@property (<#strong#><#weak#><#assign#>, nonatomic) <#IBOutlet#><#Type#> *<#propertyName#>; | |
Pragma Marks | |
------------ | |
#pragma mark - <#Main Section#> | |
#pragma mark <#Sub Section#> | |
String Constants | |
---------------- | |
extern NSString *const <#String Constant Variable Name#>; | |
NSString *const <#String Constant Variable Name#> = @"<#String Value#>"; |
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 Web View Delegate | |
- (void)webViewDidStartLoad:(UIWebView *)webView | |
{ | |
[self toggleProgressHUDVisiblity:true]; | |
} | |
- (void)webViewDidFinishLoad:(UIWebView *)webView | |
{ | |
[self toggleProgressHUDVisiblity:false]; | |
} | |
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error | |
{ | |
[self toggleProgressHUDVisiblity:false]; | |
} | |
- (void)toggleProgressHUDVisiblity:(BOOL)visible | |
{ | |
UIView *hudContainerView = <#targetView#>; | |
if (hudContainerView) | |
{ | |
if (visible) | |
{ | |
[MBProgressHUD showHUDAddedTo:hudContainerView animated:true]; | |
} | |
else | |
{ | |
[MBProgressHUD hideAllHUDsForView:hudContainerView animated:true]; | |
} | |
} | |
else | |
{ | |
NSLog(@"%s\n[%s]: Line %i] %@",__FILE__,__PRETTY_FUNCTION__,__LINE__, | |
@"no feedback container found"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment