TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2016 |
Maintained by Annisa Sofia.
To run the example project, clone the repo, and run pod install
from the Example directory first.
ASNRealm is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ASNRealm'
@property int productId; @property NSString *title; @property NSString *descriptions; @property RLMArray *images; @property RLMArray *prices; @property RLMArray *stocks; @property RLMArray *variants; @property BOOL wishlist;
RLMResults <0x7f94b8f6f990> (
[0] Product {
productId = 7;
title = title2;
descriptions = desc2;
images = RLMArray <0x7f94b8f74c90> (
[0] Image {
image = http://proprofs-cdn.s3.amazonaws.com/images/games/user_images/misc/1141652403.png;
productIdImage = 7;
},
[1] Image {
image = https://pixabay.com/static/uploads/photo/2013/08/11/19/37/flower-171644_960_720.jpg;
productIdImage = 7;
}
);
prices = RLMArray <0x7f94b8f75ed0> (
[0] Price {
price = 140;
productIdPrice = 7;
},
[1] Price {
price = 150;
productIdPrice = 7;
}
);
stocks = RLMArray <0x7f94b8f76970> (
[0] Stock {
stock = 15;
productIdStock = 7;
},
[1] Stock {
stock = 25;
productIdStock = 7;
}
);
variants = RLMArray <0x7f94b8f75c90> (
[0] Variant {
variant = red;
productIdVariant = 7;
},
[1] Variant {
variant = black;
productIdVariant = 7;
}
);
wishlist = 0;
}
#import <ASNRealm/Product.h>
Property sort is attribute name
RLMResults *result = [product getAllProductWithPropertyForSort:@"productId" withAscending:YES];
NSLog(@"result: %@",result);
Product *product = [[Product alloc]init];
RLMResults *result = [product getAllProductWithPropertyForSort:@"productId" withAscending:YES];
NSLog(@"result %lu: %@",(unsigned long)result.count,result);
Product *productAtIndex = [result objectAtIndex:1];
NSLog(@"title : %@:",productAtIndex.title);
NSLog(@"descriptions : %@:",productAtIndex.descriptions);
NSArray *getImages = [product getImagesByProductObject:productAtIndex];
NSArray *getStocks= [product getStockByProductObject:productAtIndex];
NSArray *getPrices= [product getPriceByProductObject:productAtIndex];
NSArray *getVariant= [product getVariantByProductObject:productAtIndex];
NSLog(@"images : %@",getImages);
NSLog(@"stocks : %@",getStocks);
NSLog(@"price : %@",getPrices);
NSLog(@"variant : %@",getVariant);
Product *product = [[Product alloc]init];
RLMResults *result = [product searchProductWithKeyword:@"Chunky Heels"];
NSLog(@"result: %@",result);
Product *product = [[Product alloc]init];
RLMResults *result = [product getProdutById:10];
NSLog(@"result: %@",result);
Define Array of images, prices, stocks and variants first
NSArray *images = @[@"http://proprofs-cdn.s3.amazonaws.com/images/games/user_images/misc/1141652403.png", @"https://pixabay.com/static/uploads/photo/2013/08/11/19/37/flower-171644_960_720.jpg"];
NSArray *prices = @[@140.0, @150.0];
NSArray *stocks = @[@"15", @"25"];
NSArray *variants = @[@"red", @"black", @"blue"];
Create object from class of product
Product *product = [[Product alloc]init];
Create product with default value of wishlist (false)
[product createDefaultProductWithId:7 withTitle:@"Croco Bag" andDescriptions:@"Nice handbag for women" andImages:images andPrices:prices andStocks:stocks andVariants:variants];
Create product with custom value of wishlist (false/true) YES : true, NO : false
[product createProductWithId:10 withTitle:@"Chelsea Chunky Heels Boot" andDescriptions:@"Stylist boot for this winter" andImages:images andPrices:prices andStocks:stocks andVariants:variants andWishlist:YES];
Product *product = [[Product alloc]init];
[product deleteProductWithProductId:7];
Product *product = [[Product alloc]init];
RLMResults *result = [product getAllWishlistWithPropertyForSort:@"productId" withAscending:YES];
NSLog(@"result: %@",result);
Product *product = [[Product alloc]init];
[product addProductToWishlist:10];
Product *product = [[Product alloc]init];
[product removeProductFromWishlist:5];
Product *product = [[Product alloc]init];
[product emptyWishlist];
Product *product = [[Product alloc]init];
[product emptyProduct];
Define Array of images, prices, stocks and variants first
NSArray *images = @[@"http://proprofs-cdn.s3.amazonaws.com/images/games/user_images/misc/1141652403.png", @"https://pixabay.com/static/uploads/photo/2013/08/11/19/37/flower-171644_960_720.jpg"];
NSArray *prices = @[@80.0, @50.0, @70];
NSArray *stocks = @[@"10", @"5"];
NSArray *variants = @[@"red", @"black", @"blue"];
Create object from class of product
Product *product = [[Product alloc]init];
Edit product
[product editProductWithId:7 withTitle:@"Croco Bag Sale!" andDescriptions:@"Now favorite item on SALE" andImages:images andPrices:prices andStocks:stocks andVariants:variants andWishlist:YES];
Annisa Sofia Noviantina, [email protected]