-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTools.h
65 lines (36 loc) · 1.22 KB
/
Tools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Tools.h
// Weather
//
// Created by Егор Иванов on 15/01/15.
// Copyright (c) 2015 organization. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface Tools : NSObject
// Threads
+(void)runInBackground:(void(^)(void))block;
+(void)runLater:(NSTimeInterval)delay block:(void(^)(void))block;
+(void)runOnMainThread:(void(^)(void))block;
// Networking
+(void)jsonRequest:(NSString*)request withCompletion:(void (^)(NSDictionary *json))completion;
// iOS 8 alerts
+(void)showAlertWithTitle:(NSString*)title message:(NSString*)message actions:(NSArray*)actions;
+(UIAlertAction *)alertActionWithTitle:(NSString*)title block:(void (^)(UIAlertAction *action))handler;
// Core graphics
CGSize CGSizeAspectFit(CGSize aspectRatio, CGSize boundingSize);
CGSize CGSizeAspectFill(CGSize aspectRatio, CGSize minimumSize);
// Collections
+(void)findObjectForKey:(NSString*)desiredKey inDict:(NSDictionary*)dict withResultBlock:(void (^)(id result))resultBlock;
@end
// Categories
@interface UIView (Metrics)
-(CGPoint)centerForSubviews;
-(CGFloat)width;
-(CGFloat)height;
-(void)roundToNearestPixelEdges;
-(CGFloat)minX;
-(CGFloat)maxX;
-(CGFloat)minY;
-(CGFloat)maxY;
@end