Last active
August 14, 2019 16:59
-
-
Save twhitt14/f9051a6fa030e0571c6acec0141e9c17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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