Skip to content

Commit 5a5b9be

Browse files
committed
CoreModule v2.5.0.
1 parent 60cb6f6 commit 5a5b9be

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Source/Math.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// Math.swift
3+
// CoreModule
4+
//
5+
// Created by Maxim Ivanov on 09.09.2023.
6+
//
7+
8+
public func almostEqual<T>(_ x: T, _ y: T) -> Bool where T: Comparable, T: SignedNumeric {
9+
10 * abs(x - y) <= min(abs(x), abs(y))
10+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// UIView+Core.swift
3+
// CoreModule
4+
//
5+
// Created by Maxim Ivanov on 07.09.2023.
6+
//
7+
8+
import UIKit
9+
10+
extension UIView {
11+
12+
public func findViewController() -> UIViewController? {
13+
if let nextResponder = self.next as? UIViewController {
14+
return nextResponder
15+
} else if let nextResponder = self.next as? UIView {
16+
return nextResponder.findViewController()
17+
} else {
18+
return nil
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)