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
#include <sys/xattr.h> | |
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL{ | |
const char* filePath = [[URL path] fileSystemRepresentation]; | |
const char* attrName = "com.apple.MobileBackup"; | |
u_int8_t attrValue = 1; | |
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); | |
return result == 0; | |
} |
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
int main(int argc, char *argv[]) | |
{ | |
@autoreleasepool { | |
@try { | |
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); | |
} | |
@catch (NSException *exception) { | |
NSLog(@"Uncaught exception: %@", exception.name); |
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
#if ! __has_feature(objc_arc) | |
#error This .m-file must be compiled with ARC. use the "-fobjc-arc" compiler flag for this file in your Target/Build Phases/Compile Sources Section | |
#endif |
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 File regular Objective-C Header | |
@interface SimpleHttpRequest : NSObject <NSURLConnectionDelegate>{ | |
__weak id _delegate; | |
SEL _didFailSelector; | |
NSURLRequest* _urlrequest; | |
NSObject* _iVarABC; | |
} | |
@property (nonatomic, weak) id delegate; |
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 File optimized Objective-C Class Header | |
@interface SimpleHttpRequest : NSObject | |
@property (nonatomic, weak) id delegate; | |
@property (nonatomic, assign) SEL didFailSelector; | |
@property (nonatomic, copy, readonly) NSURLRequest* urlrequest; | |
+(SimpleHttpRequest *)requestWithNSURLRequest:(NSURLRequest*)urlrequest; | |
-(void)startAsynchronous; |
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
//.m File optimized Objective-C Class Implementation | |
@interface SimpleHttpRequest()<NSURLConnectionDelegate>{ //Private interface | |
NSObject* _iVarABC; | |
NSObject* _someThing; | |
__unsafe_unretained NSObject* _anyThing; | |
NSURLRequest* _urlrequest; | |
__weak id _delegate; | |
SEL _didFailSelector; | |
} |
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)addSkipBackupAttributeToItemAtURL:(NSURL *)URL{ | |
return [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil]; | |
} |
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
//"modern Objective-C" syntax | |
//new enum-macros for better autocompletion, switch statement, more precise warnings, ... | |
typedef NS_ENUM(NSInteger, MyViewContentMode) { | |
MyViewContentModeLeft, | |
MyViewContentModeRight, | |
MyViewContentModeTopLeft, | |
MyViewContentModeTopRight, |
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 | |
public class LoginRequest { | |
public var userId: String = "" | |
public var password: String = "" | |
public init(userId: String, password: String) { | |
self.userId = userId | |
self.password = password |
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 | |
public class LoginResponse { | |
public var text: String = "" | |
public init (text: String) { | |
self.text = text | |
} |
OlderNewer