Another attempt to fix empty URL bar
This commit is contained in:
30
App/Utilities/LayoutLatch.swift
Normal file
30
App/Utilities/LayoutLatch.swift
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// LayoutLatch.swift
|
||||
// App
|
||||
//
|
||||
// Created by James Magahern on 8/10/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class LayoutLatch {
|
||||
public weak var view: UIView?
|
||||
public private(set) var latched: Bool = false
|
||||
|
||||
init(_ view: UIView) {
|
||||
self.view = view
|
||||
}
|
||||
|
||||
public func activate() {
|
||||
latched = true
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) { [weak self] in
|
||||
self?.deactivate()
|
||||
}
|
||||
}
|
||||
|
||||
public func deactivate() {
|
||||
latched = false
|
||||
view?.setNeedsLayout()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user