54 lines
1.6 KiB
Swift
54 lines
1.6 KiB
Swift
//
|
|
// MenuModuleViewIPAD.swift
|
|
// PrivadoVPN
|
|
//
|
|
// Created by Zhandos Bolatbekov on 08.07.2021.
|
|
// Copyright © 2021 Privado LLC. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
final class MenuModuleViewIPAD: UIButton {
|
|
|
|
private enum Constants {
|
|
enum ImageName {
|
|
static let leftMenu = "leftMenu.ipad"
|
|
}
|
|
enum Geometry {
|
|
static let imageSize = CGSize(width: 33, height: 24)
|
|
}
|
|
}
|
|
|
|
var output: MenuServerModuleOutput
|
|
|
|
init(output: MenuServerModuleOutput) {
|
|
|
|
self.output = output
|
|
super.init(frame: .zero)
|
|
|
|
self.configureUI()
|
|
self.addTarget(self, action: #selector(self.menuClick), for: .touchUpInside)
|
|
}
|
|
|
|
required init?(coder: NSCoder) { nil }
|
|
|
|
@objc
|
|
private func menuClick() {
|
|
self.output.openMenu()
|
|
}
|
|
|
|
private func configureUI() {
|
|
self.translatesAutoresizingMaskIntoConstraints = false
|
|
let menuImage = UIImage(imageLiteralResourceName: Constants.ImageName.leftMenu)
|
|
let menuImageView = UIImageView(image: menuImage)
|
|
menuImageView.translatesAutoresizingMaskIntoConstraints = false
|
|
self.addSubview(menuImageView)
|
|
NSLayoutConstraint.activate([
|
|
menuImageView.heightAnchor.constraint(equalToConstant: Constants.Geometry.imageSize.height),
|
|
menuImageView.widthAnchor.constraint(equalToConstant: Constants.Geometry.imageSize.width),
|
|
menuImageView.centerXAnchor.constraint(equalTo: self.centerXAnchor),
|
|
menuImageView.centerYAnchor.constraint(equalTo: self.centerYAnchor)
|
|
])
|
|
}
|
|
}
|