Skip to content

Instantly share code, notes, and snippets.

@backslash-f
Created July 26, 2018 22:36
Show Gist options
  • Save backslash-f/203871caf203265a90feeb327f17d44f to your computer and use it in GitHub Desktop.
Save backslash-f/203871caf203265a90feeb327f17d44f to your computer and use it in GitHub Desktop.
RoundedViewPlusShadow
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