Created
November 21, 2019 09:22
-
-
Save Sangsom/b373de3d76b14a3f943f07ff67f82f84 to your computer and use it in GitHub Desktop.
Sample of how to organise Swift global constants
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 | |
struct Constants { | |
struct Design { | |
struct Color { | |
struct Primary { | |
static let Blue = UIColor(red: 0, green: 122, blue: 255, alpha: 1) | |
static let BlueDisabled = UIColor(red: 28, green: 155, blue: 248, alpha: 1) | |
static let Purple = UIColor(red: 80, green: 48, blue: 246, alpha: 1) | |
static let PurpleDisabled = UIColor(red: 98, green: 68, blue: 255, alpha: 1) | |
} | |
struct Secondary { | |
static let NeonBlue = UIColor(red: 0, green: 255, blue: 255, alpha: 1) | |
static let Pink = UIColor(red: 255, green: 72, blue: 210, alpha: 1) | |
static let Turquise = UIColor(red: 25, green: 221, blue: 227, alpha: 1) | |
static let RedPurple = UIColor(red: 236, green: 26, blue: 81, alpha: 1) | |
} | |
struct Grayscale { | |
static let Light = UIColor(red: 242, green: 243, blue: 248, alpha: 1) | |
static let Mid = UIColor(red: 162, green: 163, blue: 177, alpha: 1) | |
static let Dark = UIColor(red: 50, green: 48, blue: 70, alpha: 1) | |
static let Black = UIColor(red: 21, green: 23, blue: 33, alpha: 1) | |
} | |
} | |
struct Image { | |
static let IcoCategory = UIImage(named: "ico_category") | |
static let IcoClose = UIImage(named: "ico_close") | |
} | |
struct Font { | |
static let Body = UIFont.systemFont(ofSize: 15, weight: .regular) | |
static let Bold = UIFont.systemFont(ofSize: 15, weight: .bold) | |
static let Sub = UIFont.systemFont(ofSize: 13, weight: .regular) | |
static let Mini = UIFont.systemFont(ofSize: 10, weight: .medium) | |
static let HeadingOne = UIFont.systemFont(ofSize: 24, weight: .semibold) | |
static let HeadingTwo = UIFont.systemFont(ofSize: 20, weight: .semibold) | |
static let HeadingThree = UIFont.systemFont(ofSize: 17, weight: .semibold) | |
} | |
} | |
struct Content { | |
static let Email = "rinalds@inbox.lv" | |
static let Login = "Login" | |
static let dummyText = "Lorem ipsum" | |
static let dummyTextMedium = "Lore ipsum dolor sit amet" | |
} | |
struct API { | |
static let twitterApiUrl = "https://api.twitter.com/" | |
static let DB_REF = Firestore.firestore() | |
static let USERS_DB_REF = DB_Ref.collection(USERS_REF) | |
static let AUTH_REF = Auth.auth() | |
static let USERS_REF = "users" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment