52 lines
1.7 KiB
Swift
52 lines
1.7 KiB
Swift
|
|
//
|
||
|
|
// SideMenuVM.swift
|
||
|
|
// WOKA
|
||
|
|
//
|
||
|
|
// Created by MacBook Pro on 21/05/24.
|
||
|
|
//
|
||
|
|
|
||
|
|
import UIKit
|
||
|
|
|
||
|
|
class SideMenuVM{
|
||
|
|
|
||
|
|
weak var vc : SideMenuVC!
|
||
|
|
|
||
|
|
func initView(){
|
||
|
|
customizeSegmentControl()
|
||
|
|
|
||
|
|
let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1)
|
||
|
|
let color2 = #colorLiteral(red: 0.6901960784, green: 0.2745098039, blue: 0.7568627451, alpha: 1)
|
||
|
|
vc.logoutBtn.applyGradient(colors: [color1, color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0))
|
||
|
|
vc.logoutBtn.layer.cornerRadius = vc.logoutBtn.frame.height / 2
|
||
|
|
|
||
|
|
// Adding the trailing constriant to make the view appeared center when expanded
|
||
|
|
let sidemenuBasicConfiguration = SideMenuController.preferences.basic
|
||
|
|
let showPlaceTableOnLeft = (sidemenuBasicConfiguration.position == .under) != (sidemenuBasicConfiguration.direction == .right)
|
||
|
|
if showPlaceTableOnLeft {
|
||
|
|
vc.selectionMenuTrailingConstraint.constant = SideMenuController.preferences.basic.menuWidth - vc.view.frame.width
|
||
|
|
}
|
||
|
|
|
||
|
|
// Add border to theme
|
||
|
|
|
||
|
|
vc.theme1.addBorderView(width: 1.5, color: UIColor.white)
|
||
|
|
vc.theme2.addBorderView(width: 1.5, color: UIColor.white)
|
||
|
|
|
||
|
|
vc.theme1.addTapGesture {
|
||
|
|
print("ss")
|
||
|
|
}
|
||
|
|
|
||
|
|
vc.theme1.addTapGesture {
|
||
|
|
print("ss")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private func customizeSegmentControl(){
|
||
|
|
// Customize Segment Control
|
||
|
|
vc.languageControl.layer.cornerRadius = vc.languageControl.layer.frame.height / 2
|
||
|
|
vc.languageControl.layer.masksToBounds = true
|
||
|
|
vc.languageControl.clipsToBounds = true
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|