Files
2022-06-03 16:55:25 +03:00

41 lines
953 B
Swift

//
// CustomControl.swift
// Wallet
//
// Created by Igor on 27.02.2021.
// Copyright © 2021 AM. All rights reserved.
//
import UIKit
class CommonControlCustom: UIControl {
@IBOutlet var contentView: UIView!
func setup() {
contentView = loadViewFromNib()
contentView.frame = bounds
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(contentView)
}
func loadViewFromNib() -> UIView {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
// swiftlint:disable force_cast
let view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView
return view
}
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
}