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
// | |
// Uiview.swift | |
// Created by praveen shrivastav on 26/08/2021. | |
// | |
import UIKit | |
extension UIView{ | |
func makeGradientView(_ colorOne:UIColor,colorTwo:UIColor ){ |
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
class PKDataManager { | |
static let defaults = UserDefaults.standard | |
// check if 'key' is present in user defaults | |
static func isKeyPresentInUserDefaults(key: String) -> Bool { | |
return defaults.object(forKey: key) != nil | |
} | |
// store the SETs as string for given 'key' in user defaults |
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 Foundation | |
import UIKit | |
extension UIColor { | |
convenience init(hexString: String, alpha: CGFloat = 1.0) { | |
let hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) | |
let scanner = Scanner(string: hexString) | |
if (hexString.hasPrefix("#")) { | |
scanner.scanLocation = 1 |
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
extension String | |
{ | |
var length: Int { | |
get { | |
return self.count | |
} | |
} | |
var startToEndRange: Range<String.Index> { | |
get { | |
let start = self.index(self.startIndex, offsetBy: 0) |
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
/* Compare two array has the same value */ | |
// firstArray = ['A', 'B', 'C', 'A'] | |
// secondArray = ['A', 'B', 'C', 'A'] | |
// firstArray.isDuplicateOf(secondArray) | |
extension Array where Element: Comparable { | |
func isDuplicateOf(as other: [Element]) -> Bool { | |
return self.count == other.count && self.sorted() == other.sorted() | |
} |
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
class Node: | |
def __init__(self, data): | |
self.data = data | |
self.next = None | |
return | |
def has_value(self, value): |