Skip to content

Instantly share code, notes, and snippets.

View sauvikatinnofied's full-sized avatar

Sauvik Dolui sauvikatinnofied

View GitHub Profile
import Foundation
import UIKit
// Usage Examples
let shadowColor = Color.shadow.value
let shadowColorWithAlpha = Color.shadow.withAlpha(0.5)
let customColorWithAlpha = Color.custom(hexString: "#123edd", alpha: 0.25).value
enum Color {
@sauvikatinnofied
sauvikatinnofied / MediumBlogFontHandling_FullCode.swift
Last active December 1, 2025 21:03
MediumBlogFontHandling_FullCode
import Foundation
import UIKit
// Usage Examples
let system12 = Font(.system, size: .standard(.h5)).instance
let robotoThin20 = Font(.installed(.RobotoThin), size: .standard(.h1)).instance
let robotoBlack14 = Font(.installed(.RobotoBlack), size: .standard(.h4)).instance
let helveticaLight13 = Font(.custom("Helvetica-Light"), size: .custom(13.0)).instance
struct Font {
@sauvikatinnofied
sauvikatinnofied / UIColorExtension.swift
Last active July 3, 2020 14:03
MediumBlog Color Constant
extension UIColor {
/**
Creates an UIColor from HEX String in "#363636" format
- parameter hexString: HEX String in "#363636" format
- returns: UIColor from HexString
*/
convenience init(hexString: String) {
@sauvikatinnofied
sauvikatinnofied / FontTypeSizeAllEnums.swift
Last active February 16, 2019 05:54
MediumBlogPost_FontHandling_Gist_3
enum FontType {
case installed(FontName)
case custom(String)
case system
case systemBold
case systemItatic
case systemWeighted(weight: Double)
case monoSpacedDigit(size: Double, weight: Double)
}
enum FontSize {
@sauvikatinnofied
sauvikatinnofied / TinyLoggerUsages.swift
Last active May 29, 2017 05:46
TinyLoggerUsages Medium Blog Post
Logger.log(message: "This is a DEBUG message", event: .d) // DEBUG log
Logger.log(message: "This is an ERROR message", event: .e) // ERROR log
Logger.log(message: "This is an INFO message", event: .i) // INFO log
Logger.log(message: "This is a VERBOSE message", event: .v) // VERBOSE log
Logger.log(message: "This is a WARNING message", event: .w) // WARNING log
Logger.log(message: "This is a SEVERE message", event: .s) // SEVERE Error log
// LOG ON XCODE CONSOLE
2017-05-13 12:56:34445 [💬][AppDelegate.swift]:20 19 application(_:didFinishLaunchingWithOptions:) -> This is a DEBUG message
2017-05-13 12:56:34463 [‼️][AppDelegate.swift]:21 19 application(_:didFinishLaunchingWithOptions:) -> This is an ERROR message
@sauvikatinnofied
sauvikatinnofied / ShimmerView.swift
Created April 11, 2017 19:41
List Load Showing Shimmer View
import UIKit
class ShimmerView: UIView {
var primaryColor: UIColor = UIColor(red: 214.0/255.0, green: 214.0/255.0, blue: 214.0/255.0, alpha: 1.0)
var animationColor: UIColor = .white
@sauvikatinnofied
sauvikatinnofied / ColorScheme.swift
Last active March 23, 2017 12:54
Color Scheme Categories
enum Color {
case theme
case border
case shadow
case darkBackground
case lightBackground
case intermidiateBackground
@sauvikatinnofied
sauvikatinnofied / ThemeColor.swift
Last active March 23, 2017 12:54
MediumBlog Colour schemes
extension Color {
var value: UIColor {
var instanceColor = UIColor.clear
switch self {
case .border:
instanceColor = UIColor(hexString: "#333333")
case .theme:
instanceColor = UIColor(hexString: "#ffcc00")
@sauvikatinnofied
sauvikatinnofied / PinterestHome.json
Created March 22, 2017 17:30
NetworkLibrary Test Response JSON
[
{
"id":"4kQA1aQK8-Y",
"created_at":"2016-05-29T15:42:02-04:00",
"width":2448,
"height":1836,
"color":"#060607",
"likes":12,
"liked_by_user":false,
"user":{
[{
"title": "Apple MacBook Pro MF839HN/A 13-inch Laptop (Core i5/8GB/128GB/OS X Yosemite/Intel Iris Graphics 6100)",
"desc": "A groundbreaking Retina display. Powerful dual-core and quad-core Intel processors. Fast flash storage. High-performance graphics. Great built-in apps. And now in the 13-inch model, a revolutionary new Force Touch trackpad and even longer battery life.1 Whatever you can imagine, MacBook Pro with Retina display gives you the power to create.",
"priceInUSDollar": 1290.0,
"imageURL": "http://ecx.images-amazon.com/images/I/61R5Fro8r3L._SL100_.jpg"
}, {
"title": "Apple Macbook Pro MD101HN/A 13-inch Laptop (Core i5/4GB/500GB/Mac OS Mavericks/Intel HD Graphics), Silver",
"desc": "The Apple Macbook Pro has a design that can only come from the artists at apple. The lightweight grey-white shiny finish with a simplistic apple logo is something that will turn heads wherever you go. The design uses lightweight but strong aluminium to make sure that your system weighs only 1.35kg to ensure tha