ThumbView.swift 591 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // ThumbView.swift
  3. // LoopKitUI
  4. //
  5. // Created by Michael Pangburn on 2/23/20.
  6. // Copyright © 2020 LoopKit Authors. All rights reserved.
  7. //
  8. import UIKit
  9. class ThumbView: UIView {
  10. override func layoutSubviews() {
  11. super.layoutSubviews()
  12. backgroundColor = .white
  13. makeRound()
  14. configureDropShadow()
  15. }
  16. private func makeRound() {
  17. layer.cornerRadius = min(frame.width, frame.height) / 2
  18. }
  19. private func configureDropShadow() {
  20. layer.shadowOpacity = 0.3
  21. layer.shadowOffset = CGSize(width: -2, height: 0)
  22. }
  23. }