Skip to content

Commit

Permalink
CoreModule v2.5.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimn committed Sep 17, 2023
1 parent 60cb6f6 commit 5a5b9be
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Source/Math.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Math.swift
// CoreModule
//
// Created by Maxim Ivanov on 09.09.2023.
//

public func almostEqual<T>(_ x: T, _ y: T) -> Bool where T: Comparable, T: SignedNumeric {
10 * abs(x - y) <= min(abs(x), abs(y))
}
21 changes: 21 additions & 0 deletions Source/UIKit+Core/UIView+Core.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// UIView+Core.swift
// CoreModule
//
// Created by Maxim Ivanov on 07.09.2023.
//

import UIKit

extension UIView {

public func findViewController() -> UIViewController? {
if let nextResponder = self.next as? UIViewController {
return nextResponder
} else if let nextResponder = self.next as? UIView {
return nextResponder.findViewController()
} else {
return nil
}
}
}

0 comments on commit 5a5b9be

Please sign in to comment.