Skip to content

Instantly share code, notes, and snippets.

View monkeywithacupcake's full-sized avatar
coffee me

jess monkeywithacupcake

coffee me
View GitHub Profile
@monkeywithacupcake
monkeywithacupcake / CustomUIView.Playground
Created October 22, 2017 06:10
How to use a custom UIView in another View controller programmatically and handle constraints in Swift 4.
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyView: UIView {
let label = UILabel()
func updateText(_ text:String?) {
@monkeywithacupcake
monkeywithacupcake / SelectingCollectionView.playground
Last active October 20, 2017 01:42
Swift .playground showing how to programmatically change the height of items in a stack view and track cells selected and unselected.
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
extension UIView {
func asCircle(){
self.layer.cornerRadius = self.frame.width / 2;
self.layer.masksToBounds = true
}
@monkeywithacupcake
monkeywithacupcake / CollectionViewUnicodeEmojis.playground
Created October 19, 2017 02:41
Swift 4 Playground showing how to build StackView, Horizontal CollectionView, and work with unicode emojis programmatically
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
extension String {
func getUnicodeCodePoints() -> [String] {
return unicodeScalars.map { "U+" + String($0.value, radix: 16, uppercase: true) }
}
}