Skip to content

Instantly share code, notes, and snippets.

Fonts.font(.poppins, size: 12)
static func font(_ name: Font, size: CGFloat) -> UIFont {
UIFont(name: name.rawValue, size: size)!
}
UIFont(name: Fonts.Font.poppins.rawValue, size: 12)
@vinczebalazs
vinczebalazs / fonts1.swift
Created February 10, 2020 18:08
fonts part 1
struct Fonts {
enum Font: String {
case poppins = "Poppins"
case quicksand = "Quicksand"
}
}
@vinczebalazs
vinczebalazs / uifontexmaple.swift
Created February 10, 2020 18:00
UIFont example
UIFont(name: "Quicksand-Bold", weight: 16)
@vinczebalazs
vinczebalazs / CornerRadiusPlayground.swift
Created February 9, 2020 22:30
A Playground to reproduce a cornerRadius anomality.
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
final class Cell: UITableViewCell {
private let borderLayer = CAShapeLayer()
private let _backgroundView = UIView()
@vinczebalazs
vinczebalazs / CellExample.swift
Created January 25, 2020 23:18
Cell example
cell.item = items[indexPath.row]
@vinczebalazs
vinczebalazs / NamedColorsExample.swift
Created January 25, 2020 23:15
Named colors example
UIColor(named: "Primary")
@vinczebalazs
vinczebalazs / UIColor+NamedColors.swift
Last active April 13, 2020 05:34
UIColor+NamedColors
extension UIColor {
static var accent: UIColor {
UIColor(named: "Accent")!
}
static var primary: UIColor {
UIColor(named: "Primary")!
}
static var primaryText: UIColor {
@vinczebalazs
vinczebalazs / UIViewController+Embed.swift
Created January 25, 2020 22:59
UIViewController+Embed
extension UIViewController {
func embed(_ vc: UIViewController, in _containerView: UIView? = nil) {
let containerView: UIView = _containerView ?? view // Use the whole view if no container view is provided.
containerView.addSubview(vc.view)
NSLayoutConstraint.activate([
vc.view.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: 0),
vc.view.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: 0),
vc.view.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 0),
vc.view.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: 0)
])