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
func onAction() { | |
let controller = SecondViewController() | |
controller.delegate = self | |
self.navigation?.pushViewController(controller, animated: true) | |
} |
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
class Coordinator: FirstControllerDelegate { | |
let window: UIWindow | |
var navigation: UINavigationController? | |
lazy var firstViewController: FirstViewController = { | |
let controller = FirstViewController() | |
controller.delegate = self | |
return controller | |
}() | |
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
class Coordinator: FirstControllerDelegate { | |
let window: UIWindow | |
var navigation: UINavigationController? | |
lazy var firstViewController: FirstViewController = { | |
let controller = FirstViewController() | |
controller.delegate = self | |
return controller | |
}() | |
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
class func fetchFriends(cursor: String?) { | |
if FBSDKAccessToken.current() != nil { | |
var params = [String: String]() | |
params["fields"] = "id,name,picture,first_name,last_name,middle_name" | |
if let after = cursor { | |
params["after"] = after | |
} | |
let request: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me/taggable_friends", parameters: params, httpMethod: "GET") | |
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
{"bug_type":"109","os_version":"iPhone OS 8.3 (12F70)","build_version":"5.3.2.14","is_beta":true,"app_name":"Viber","app_cohort":"2|date=1429045200000&sf=143441&tid=3b86f5c36d1a7ce5745dcf755fae03cde3c25dc4fa19ab99ca21fdfffdd39cf6","bundleID":"com.viber","name":"Viber","is_first_party":false,"app_version":"5.3.2","share_with_app_devs":false,"slice_uuid":"0087630e-61ef-3086-b085-89601b56e036","adam_id":382617920} | |
Incident Identifier: D1096BD3-35EF-41BC-80CF-BFF1F9DEA4F0 | |
Beta Identifier: 321C7B2F-8FA5-4494-A2B5-DFE2FBB74CC7 | |
Hardware Model: iPhone5,1 | |
Process: Viber [1813] | |
Path: /private/var/mobile/Containers/Bundle/Application/F00EBAAC-D1E6-4B5E-AFD8-EC78D4506FE5/Viber.app/Viber | |
Identifier: com.viber | |
Version: 5.3.2.14 (5.3.2) | |
Beta: YES |
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> | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
int p, d; | |
BOOL isPrime; | |
for (p = 2; p <= 50; ++p) { | |
isPrime = YES; |
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
- (NSString *)reverse:(NSString *)source { | |
if (!source) { | |
return nil; | |
} | |
NSMutableString *reversed = [NSMutableString new]; | |
[source enumerateSubstringsInRange:NSMakeRange(0, [source length]) options:NSStringEnumerationReverse | NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { | |
[reversed appendString:substring]; | |
}]; | |
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
- (BOOL)isPhoneValid:(NSString *)phone | |
{ | |
NSCharacterSet *phoneSet = [NSCharacterSet characterSetWithCharactersInString:@"-+0123456789()"]; | |
return [[phone stringByTrimmingCharactersInSet:phoneSet] isEqualToString:@""]; | |
} | |
- (BOOL)isPhoneNumberValid:(NSString *)phone | |
{ | |
NSError *error; | |
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypePhoneNumber error:&error]; |
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)decompressImage:(UIImage *)image | |
{ | |
if ( image ) { | |
UIGraphicsBeginImageContext(CGSizeMake(1, 1)); | |
[image drawAtPoint:CGPointZero]; | |
UIGraphicsEndImageContext(); | |
} | |
} |
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 Person : NSObject | |
@property (copy) NSString *firstName; | |
@property (copy) NSString *lastName; | |
- (instancetype)initWithFirstName:(NSString *)firstName andLastName:(NSString *)lastName; | |
@end |