Skip to content

Instantly share code, notes, and snippets.

frame variable -d r MYVAR
fr var MYVAR
po MYVAR
xcrun simctl erase all
import Foundation
import UIKit
/// Checkbox is a simple, animation free checkbox and UISwitch alternative designed
/// to be performant and easy to implement.
public class Checkbox: UIControl {
// MARK: - Enums
/// Shape of the center checkmark that appears when `Checkbox.isChecked == true`.
import UIKit
import PureLayout
extension UIViewController {
func addChildController(_ controller: UIViewController, containerView: UIView) {
addChild(controller)
// When your custom container calls the addChild(_:) method, it automatically calls the willMove(toParent:) method of the view controller to be added as a child before adding it.
containerView.addSubview(controller.view)
controller.view.translatesAutoresizingMaskIntoConstraints = false
controller.view.autoPinToSuperviewEdges()
@chriswill0w
chriswill0w / AppStoryboard.swift
Created July 26, 2018 08:49 — forked from Gurdeep0602/AppStoryboard.swift
AppStoryboard enumeration
//
// AppStoryboards.swift
// AppStoryboards
//
// Created by Gurdeep on 15/12/16.
// Copyright © 2016 Gurdeep. All rights reserved.
//
import Foundation
import UIKit
extension Data {
var sizeMB: String{
let formatter = ByteCountFormatter()
formatter.allowedUnits = [.useMB]
formatter.countStyle = .file
return formatter.string(fromByteCount: Int64(self.count))
}
}
extension UIViewController {
func add(_ child: UIViewController) {
addChildViewController(child)
view.addSubview(child.view)
child.didMove(toParentViewController: self)
}
func remove() {
guard parent != nil else {
return
}
extension UIViewController {
func add(_ child: UIViewController) {
addChildViewController(child)
view.addSubview(child.view)
child.didMove(toParentViewController: self)
}
func remove() {
guard parent != nil else {
return
}
@chriswill0w
chriswill0w / Fonts.swift
Last active September 20, 2018 10:48 — forked from khanlou/Fonts.swift
Print all fonts in Swift 4 UIFont
for family in UIFont.familyNames {
let sName: String = family as String
print("family: \(sName)")
for name in UIFont.fontNames(forFamilyName: sName) {
print("name: \(name as String)")
}
}