Files
2021-09-02 09:37:25 +00:00

26 lines
489 B
Swift

//
// FocusableOnRect.swift
// PrivadoVPN
//
// Created by Zhandos Bolatbekov on 02.09.2021.
// Copyright © 2021 Privado LLC. All rights reserved.
//
import UIKit
protocol FocusableOnRect {
var activeRect: CGRect? { get set }
func focusIfNeeded()
}
extension FocusableOnRect where Self: UIScrollView {
func focusIfNeeded() {
guard let rect = self.activeRect else { return }
self.scrollRectToVisible(rect, animated: true)
}
}