Skip to content

Instantly share code, notes, and snippets.

@dgyesbreghs
Created June 9, 2017 18:23
Show Gist options
  • Save dgyesbreghs/0447cac817ce6759092210551a96cb0f to your computer and use it in GitHub Desktop.
Save dgyesbreghs/0447cac817ce6759092210551a96cb0f to your computer and use it in GitHub Desktop.
//
// UIView+RoundCorners.swift
// PullableView
//
// Created by Dylan Gyesbreghs on 09/06/2017.
// Copyright © 2017 Dylan Gyesbreghs. All rights reserved.
//
import UIKit
extension UIView {
func roundCorners(_ corners: UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: self.bounds,
byRoundingCorners: corners,
cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment