I'm setting a bottom buttons StackView and I just found out that whenever I set it I find you that the memory use goes up immediately.
this is the code I implement in viewDidLoad() to setUp the bottom stackView:
@objc fileprivate func setUPUI(){
let buttonsStackView = UIStackView(arrangedSubviews: [acceptButton, detailButton, cancelButton])
buttonsStackView.axis = .horizontal
buttonsStackView.distribution = .equalSpacing
buttonsStackView.alignment = .center
buttonsStackView.spacing = 20
//defining buttons Constraints
acceptButton.heightAnchor.constraint(equalToConstant: sideViewsSize).isActive = true
acceptButton.widthAnchor.constraint(equalToConstant: sideViewsSize).isActive = true
detailButton.heightAnchor.constraint(equalToConstant: centerViewSize).isActive = true
detailButton.widthAnchor.constraint(equalToConstant: centerViewSize).isActive = true
cancelButton.heightAnchor.constraint(equalToConstant: sideViewsSize).isActive = true
cancelButton.widthAnchor.constraint(equalToConstant: sideViewsSize).isActive = true
//setting shadows
acceptButton.setupShadow(opacity: 0.7, radius: 4, offset: .init(width: 0, height: 0), color: .darkGray)
detailButton.setupShadow(opacity: 0.7, radius: 4, offset: .init(width: 0, height: 0), color: .darkGray)
cancelButton.setupShadow(opacity: 0.7, radius: 4, offset: .init(width: 0, height: 0), color: .darkGray)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(buttonsStackView)
buttonsStackView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -5).isActive = true
buttonsStackView.heightAnchor.constraint(equalToConstant: 90).isActive = true
buttonsStackView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
buttonsStackView.leadingAnchor.constraint(greaterThanOrEqualTo: view.leadingAnchor,constant: 20).isActive = true
buttonsStackView.trailingAnchor.constraint(lessThanOrEqualTo: view.trailingAnchor,constant: -20).isActive = true
}
When I load the viewController it passes from 41MB to 296MB