Created
July 26, 2018 22:36
-
-
Save backslash-f/203871caf203265a90feeb327f17d44f to your computer and use it in GitHub Desktop.
RoundedViewPlusShadow
This file contains 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
import UIKit | |
import PlaygroundSupport | |
let subviewFrame = CGRect(x: 50, y: 50, width: 300, height: 300) | |
let subview = UIView(frame: subviewFrame) | |
subview.backgroundColor = .yellow | |
subview.layer.cornerRadius = 20 | |
subview.layer.shadowColor = UIColor.black.cgColor | |
subview.layer.shadowOffset = CGSize(width: 0, height: 3) | |
subview.layer.shadowOpacity = 0.3 | |
subview.layer.shadowRadius = 4 | |
let containerViewFrame = CGRect(x: 0, y: 0, width: 400, height: 400) | |
let containerView = UIView(frame: containerViewFrame) | |
containerView.backgroundColor = .white | |
containerView.addSubview(subview) | |
PlaygroundPage.current.liveView = containerView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment