Skip to content

Instantly share code, notes, and snippets.

View Shubham0812's full-sized avatar
🎯
Focusing

Shubham Kr. Singh Shubham0812

🎯
Focusing
View GitHub Profile
import Foundation
import OSLog
enum LogType {
case info
case notice
case warning
case fault
// case debug
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.registerForAppTrackingTransparency(launchOptions)
return true
}
private func registerForAppTrackingTransparency(_ launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { (status) in
import Foundation
class Box<T> {
typealias Listener = (T) -> ()
// MARK:- variables
var value: T {
didSet {
listener?(value)
<key>UIAppFonts</key>
<array>
<string>Code Pro Bold LC.otf</string>
<string>Code Pro LC.otf</string>
<string>Montserrat-Bold.ttf</string>
<string>Montserrat-Italic.ttf</string>
<string>Montserrat-Medium.ttf</string>
<string>Montserrat-MediumItalic.ttf</string>
<string>Montserrat-Regular.ttf</string>
<string>Montserrat-SemiBold.ttf</string>
import UIKit
extension UIColor {
/// For converting Hex-based colors
convenience init(hex: String) {
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
var rgb: UInt64 = 0
var r: CGFloat = 0.0
import UIKit
extension UIColor {
/// For converting Hex-based colors
convenience init(hex: String) {
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
var rgb: UInt64 = 0
var r: CGFloat = 0.0
import SwiftUI
extension Color {
init(hex: String) {
self.init(UIColor(hex: hex))
}
}
extension UIColor {
<key>UIAppFonts</key>
<array>
<string>Montserrat-Bold.ttf</string>
<string>Montserrat-Italic.ttf</string>
<string>Montserrat-Medium.ttf</string>
<string>Montserrat-MediumItalic.ttf</string>
<string>Montserrat-Regular.ttf</string>
<string>Montserrat-SemiBold.ttf</string>
<string>Montserrat-SemiBoldItalic.ttf</string>
<string>Montserrat-Thin.ttf</string>
import SwiftUI
enum Montserrat {
case thin
case thinItalic
case regular
case italic
case medium
case mediumItalic
case semibold
import SwiftUI
extension Color {
init(hex: String) {
self.init(UIColor(hex: hex))
}
static func randomColor() -> Color {
return Color(UIColor.random())