Skip to content

Instantly share code, notes, and snippets.

View scott-lydon's full-sized avatar

Scott scott-lydon

  • High Five
  • Burlingame
View GitHub Profile
@nderkach
nderkach / uiimageviewmask.swift
Created June 16, 2017 17:36
iOS: set UIImage mask
let maskLayer = CALayer()
let maskImage = UIImage(named: "avatar-mask")?.cgImage
maskLayer.frame = CGRect(x: 0, y: 0, width: profileImageView.bounds.size.width, height: profileImageView.bounds.size.height)
maskLayer.contents = maskImage;
profileImageView.layer.mask = maskLayer
profileImageView.layer.masksToBounds = true