commit | author | age
|
a0a843
|
1 |
// |
H |
2 |
// TWTRMediaEntitySize.h |
|
3 |
// TwitterKit |
|
4 |
// |
|
5 |
// Copyright (c) 2016 Twitter. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <UIKit/UIKit.h> |
|
9 |
|
|
10 |
NS_ASSUME_NONNULL_BEGIN |
|
11 |
|
|
12 |
typedef NS_ENUM(NSUInteger, TWTRMediaEntitySizeResizingMode) { |
|
13 |
TWTRMediaEntitySizeResizingModeFit, |
|
14 |
TWTRMediaEntitySizeResizingModeCrop, |
|
15 |
}; |
|
16 |
|
|
17 |
FOUNDATION_EXPORT NSString *NSStringFromTWTRMediaEntitySizeResizingMode(TWTRMediaEntitySizeResizingMode resizingMode); |
|
18 |
FOUNDATION_EXPORT TWTRMediaEntitySizeResizingMode TWTRMediaEntitySizeResizingModeFromString(NSString *resizingModeString); |
|
19 |
|
|
20 |
@interface TWTRMediaEntitySize : NSObject <NSCoding> |
|
21 |
|
|
22 |
/** |
|
23 |
* The name of the size. 'large', 'medium', etc. |
|
24 |
*/ |
|
25 |
@property (nonatomic, copy, readonly) NSString *name; |
|
26 |
|
|
27 |
/** |
|
28 |
* Resize mode of the image size e.g. Fit, Crop. |
|
29 |
*/ |
|
30 |
@property (nonatomic, readonly) TWTRMediaEntitySizeResizingMode resizingMode; |
|
31 |
|
|
32 |
/** |
|
33 |
* The actual size. |
|
34 |
*/ |
|
35 |
@property (nonatomic, readonly) CGSize size; |
|
36 |
|
|
37 |
- (instancetype)init NS_UNAVAILABLE; |
|
38 |
|
|
39 |
/** |
|
40 |
* Designated initializer. |
|
41 |
* |
|
42 |
* @param name The name of the size. If nil will default to the empty string. |
|
43 |
* @param resizingMode The resizing mode of this entity size. |
|
44 |
* @param size The size of the entity. |
|
45 |
*/ |
|
46 |
- (instancetype)initWithName:(NSString *)name resizingMode:(TWTRMediaEntitySizeResizingMode)resizingMode size:(CGSize)size NS_DESIGNATED_INITIALIZER; |
|
47 |
|
|
48 |
- (BOOL)isEqualToMediaEntitySize:(TWTRMediaEntitySize *)otherSize; |
|
49 |
|
|
50 |
/** |
|
51 |
* Returns a dictionary of valid `TWTRMediaEntitySize` instances from the Twitter API response for media sizes. |
|
52 |
* |
|
53 |
* @param dictionary A parsed dictionary of media sizes from the Twitter API response |
|
54 |
* |
|
55 |
* @return Dictionary of parsed `TWTRMediaEntitySize` instances keyed by size name. |
|
56 |
*/ |
|
57 |
+ (NSDictionary *)mediaEntitySizesWithJSONDictionary:(NSDictionary *)dictionary; |
|
58 |
|
|
59 |
@end |
|
60 |
|
|
61 |
NS_ASSUME_NONNULL_END |