Files
2021-06-02 16:05:13 +06:00

49 lines
1.2 KiB
Swift

//
// BellCircleView.swift
// PrivadoVPN
//
// Created by Juraldinio on 4/15/21.
// Copyright © 2021 Privado LLC. All rights reserved.
//
import Foundation
final class BellCircleView: NSView {
private enum Constants {
enum Color {
static let stroke = NSColor(red: 25, green: 33, blue: 70)
static let fill = NSColor(red: 228, green: 59, blue: 105)
}
}
// MARK: - Init
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
self.translatesAutoresizingMaskIntoConstraints = false
}
required init?(coder: NSCoder) { super.init(coder: coder) }
// MARK: - Lifecycle
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
guard let context = NSGraphicsContext.current?.cgContext else { return }
context.saveGState()
let strokeRect = dirtyRect.offsetBy(dx: 1, dy: 1)
context.setFillColor(Constants.Color.stroke.cgColor)
context.fillEllipse(in: strokeRect)
context.setFillColor(Constants.Color.fill.cgColor)
context.fillEllipse(in: dirtyRect)
context.restoreGState()
}
}