This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy var persistentContainer: NSPersistentContainer = { | |
/* | |
The persistent container for the application. This implementation | |
creates and returns a container, having loaded the store for the | |
application to it. This property is optional since there are legitimate | |
error conditions that could cause the creation of the store to fail. | |
*/ | |
let container = NSPersistentContainer(name: "CoreDataExample") | |
container.loadPersistentStores(completionHandler: { (storeDescription, error) in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let start = CFAbsoluteTimeGetCurrent() | |
// run your work | |
let diff = CFAbsoluteTimeGetCurrent() - start | |
print("Took \(diff) seconds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Alamofire | |
import iOSDropDown | |
class ViewController: UIViewController { | |
//Variables | |
@IBOutlet weak var dropDownTxtField: DropDown! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PEAPIUtilityExt.swift | |
// ProcializeEvents | |
// | |
// Created by Chaitanya Soni on 21/06/20. | |
// Copyright © 2020 Chaitanya Soni. All rights reserved. | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can make a deep copy of your object via the following extension functions: | |
import UIKit | |
import Realm | |
import RealmSwift | |
protocol RealmListDetachable { | |
func detached() -> Self | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SharedExtensions.swift | |
// Aansim 2019 | |
// | |
// Created by chaitanyaSoni on 7/19/19. | |
// Copyright © 2019 Creative Plus. All rights reserved. | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CSKolodaViewControllerBusinessManager.swift | |
// SellQwik | |
// | |
// Created by Admin on 18/04/19. | |
// | |
import Foundation | |
extension CSKolodaViewController: BusinessManagerDelegate{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A great Swift implementation (updated for Xcode 7) using extensions, pulled together from a variety of different answers and places. You will also need the string extensions at the end. | |
Use: | |
let hexColor = UIColor(hex: "#00FF00") | |
NOTE: I added an option for 2 additional digits to the end of the standard 6 digit hex value for an alpha channel (pass in value of 00-99). If this offends you, just remove it. You could implement it to pass in an optional alpha parameter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CSKolodaViewController.swift | |
// SellQwik | |
// | |
// Created by Chaitanya Soni on 16/04/19. | |
// | |
import Foundation | |
import Koloda | |
import moa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)method:(NSString *)str withCompletion:(void (^)(NSArray* arr))callback{ | |
NSMutableArray *a = [NSArray new]; | |
[a addObject:str]; | |
callback(a); | |
} | |
[YourClassName method:@"" withCompletion:^(NSArray *arr) { | |
NSLog(arr.count) |
NewerOlder