Skip to content

Instantly share code, notes, and snippets.

View chaitanyaSoni96's full-sized avatar

Chaitanya Soni chaitanyaSoni96

View GitHub Profile
//logic
NSMutableArray* tempArray = [NSMutableArray new];
for (NSDictionary* custumerDetails in tempArrayCustomers) {
NSMutableDictionary *prunedDictionary = [NSMutableDictionary dictionary];
for (NSString * key in [custumerDetails allKeys])
{
if (![[custumerDetails objectForKey:key] isKindOfClass:[NSNull class]]){
@chaitanyaSoni96
chaitanyaSoni96 / removeDuplicates
Created June 14, 2019 11:02
Swift Extensions
extension Array where Element:Equatable {
func removeDuplicates() -> [Element] {
var result = [Element]()
for value in self {
if result.contains(value) == false {
result.append(value)
}
}
@chaitanyaSoni96
chaitanyaSoni96 / Set Scroll View Content Size Dynamically
Last active July 1, 2020 07:02
Set Scroll View Content Size Dynamically
-(void)setContentSizeForScrollView{
NSArray* scrollViewSubViews = [self.rootScrollView subviews];
CGFloat scrollViewHeight = 0;
for (UIView* views in scrollViewSubViews) {
scrollViewHeight += views.frame.size.height;
}
[self.rootScrollView setContentSize:CGSizeMake(self.view.frame.size.width, scrollViewHeight)];
//prints the current fucntion in a readable format
printf(__PRETTY_FUNCTION__);
//
#define isNSNull(value) [value isKindOfClass:[NSNull class]]
//topLeft Corner
nextCatBtn.backgroundColor = .clear
let nextBTNborderLayer = CAShapeLayer()
nextBTNborderLayer.fillColor = hexStringToUIColor(hex: "#DB3263").cgColor
nextBTNborderLayer.borderWidth = 2.0
let nextBtnBorderPath = UIBezierPath(roundedRect: previousCatBtn.bounds,
byRoundingCorners: [.topLeft],
cornerRadii: CGSize(width:10.0, height: 10.0))
extension Array where Element:Equatable {
func removeDuplicates() -> [Element] {
var result = [Element]()
for value in self {
if result.contains(value) == false {
result.append(value)
}
}
//
// CSKoladaView.swift
// SellQwik
//
// Created by Chaitanya Soni on 16/04/19.
//
import Foundation
class CSKolodaCardView{
//
// fillterDataClass.m
// SellQwik
//
// Created by Admin on 27/03/19.
//
#import "fillterDataClass.h"
#import "CatalogCategoryAssignedProductsData.h"
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"JBlues" message:@"Please login to see products" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAct = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:okAct];
[self presentViewController:alert animated:true completion:nil];