Skip to content

Instantly share code, notes, and snippets.

@twhitt14
Last active August 14, 2019 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twhitt14/f9051a6fa030e0571c6acec0141e9c17 to your computer and use it in GitHub Desktop.
Save twhitt14/f9051a6fa030e0571c6acec0141e9c17 to your computer and use it in GitHub Desktop.
// Put this in a playground
import UIKit
import PlaygroundSupport
let wrapperView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 160))
wrapperView.backgroundColor = .lightGray
let roundedCornerView = UIView(frame: CGRect(x: 50, y: 50, width: 300, height: 60))
roundedCornerView.backgroundColor = .white
wrapperView.addSubview(roundedCornerView)
roundedCornerView.layer.cornerRadius = 10
roundedCornerView.layer.borderColor = UIColor.red.cgColor
roundedCornerView.layer.borderWidth = 1
// this is the important part - use different corner combinations to get what you need
roundedCornerView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
PlaygroundPage.current.liveView = wrapperView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment