Skip to content

Instantly share code, notes, and snippets.

@AashirMubeeb
AashirMubeeb / ColorsStringArray.swit
Last active December 22, 2022 11:10
Colors hex strings array
let colors:[String] = [
"#F44336",
"#FFEBEE",
"#FFCDD2",
"#EF9A9A",
"#E57373",
"#EF5350",
"#F44336",
"#E53935",
"#D32F2F",
@AashirMubeeb
AashirMubeeb / ReadJson.swift
Created December 20, 2022 12:44
Read Json file form Assets file in xcode
if let assesFile = NSDataAsset.init(name: "fileName") {
let data = assesFile.data
do {
let model = try JSONDecoder().decode(Model.self, from: data)
self.processReadJsonData(model: model)
return true
}catch {
print(error.localizedDescription)
return false
}
@AashirMubeeb
AashirMubeeb / DesignableGradientView.swift
Created December 5, 2022 07:24
Draws Linear Gradient and designable from storyboard.
import Foundation
import Cocoa
// MARK: - Abstract
/// Draws Linear Gradient and designable from storyboard.
class DesignableGradientView: NSView {
@IBInspectable var isDrawGradient: Bool = false {
didSet {
//
// Created by Muhammad Ashir Mubeen on 13/07/2022.
//
#if os(iOS) || os(tvOS)
import UIKit
#elseif os(OSX)
import AppKit
#endif
import UIKit
enum AppStoryboard : String{
case Main = "Main"
case PreLogin = "Payment"
var instance : UIStoryboard {
return UIStoryboard(name: self.rawValue, bundle: Bundle.main)
}
func viewController<T>(vc : T.Type) -> T where T: UIViewController{
let identifier = String(describing: T.self)