Skip to content

Instantly share code, notes, and snippets.

@mdb1
Created December 24, 2022 18:45
Show Gist options
  • Save mdb1/d51bc6d7399468f959603542605a3544 to your computer and use it in GitHub Desktop.
Save mdb1/d51bc6d7399468f959603542605a3544 to your computer and use it in GitHub Desktop.
CGFloat Spacing Constants
import Foundation
extension CGFloat {
/// Spacing constants to use across the app.
enum Spacing {
/// Extra small spacing. (4 points).
static let xSmall: CGFloat = 4.0
/// Small spacing. (8 points).
static let small: CGFloat = 8.0
/// Medium spacing. (16 points).
static let medium: CGFloat = 16.0
/// Large spacing. (32 points).
static let large: CGFloat = 32.0
}
}
// Usage:
VStack(spacing: .Spacing.large) {
Text("Hey")
Text("You")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment