mirror of
https://github.com/status-im/react-native-camera-kit.git
synced 2025-03-01 08:00:42 +00:00
51 lines
1.2 KiB
Objective-C
51 lines
1.2 KiB
Objective-C
//
|
|
// GalleryData.m
|
|
// ReactNativeCameraKit
|
|
//
|
|
// Created by Ran Greenberg on 30/06/2016.
|
|
// Copyright © 2016 Wix. All rights reserved.
|
|
//
|
|
|
|
#import "GalleryData.h"
|
|
|
|
@interface GalleryData ()
|
|
|
|
@property (nonatomic, strong) PHFetchResult *fetchResults;
|
|
@property (nonatomic, strong, readwrite) NSArray *data;
|
|
|
|
@end
|
|
|
|
|
|
@implementation GalleryData
|
|
|
|
-(instancetype)initWithFetchResults:(PHFetchResult*)fetchResults {
|
|
|
|
self = [super init];
|
|
if (self) {
|
|
self.fetchResults = fetchResults;
|
|
self.data = [self arrayWithFetchResults:self.fetchResults];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
|
|
|
|
-(NSArray*)arrayWithFetchResults:(PHFetchResult*)fetchResults {
|
|
|
|
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
|
|
for (PHAsset *asset in fetchResults) {
|
|
NSMutableDictionary *assetDictionary = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
|
asset, @"asset",
|
|
[NSNumber numberWithBool:NO], @"isSelected",
|
|
nil];
|
|
|
|
[array addObject:assetDictionary];
|
|
}
|
|
|
|
return array;
|
|
}
|
|
|
|
|
|
@end
|