Last active
July 18, 2021 07:34
-
-
Save ezequieloliveiralima/bf7bbed46f3b8f83b8f7d7d7264eec86 to your computer and use it in GitHub Desktop.
[Dica Rápida][iOS] - Organizando suas constantes
This file contains hidden or 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 | |
fileprivate extension CGFloat { | |
static var fontSize: CGFloat = 16 | |
static var defaultMargin: CGFloat = 24 | |
} | |
class ViewController: UIViewController { | |
@IBOutlet weak var textLabel: UILabel! | |
@IBOutlet weak var trailingTextLabel: NSLayoutConstraint! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
textLabel.font = UIFont.system(.fontSize) | |
trailingTextLabel.constant = .defaultMargin | |
view.updateConstraints() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment