Helper functions

Molecule List.
Back to view instead of margins for stack due to background color issues.
Standard Header View to margin for internal use.
This commit is contained in:
Pfeil, Scott Robert 2019-04-22 13:14:22 -04:00
parent a35a92d1b2
commit 77b78c1a51
2 changed files with 17 additions and 2 deletions

View File

@ -123,6 +123,13 @@ public extension Dictionary {
return floatValue
}
func optionalCGFloatForKey(_ key: String) -> CGFloat? {
guard let key = key as? Key else {
return nil
}
return self[key] as? CGFloat
}
func floatFromStringForKey(_ key:String) -> Float {
let stringValue = stringForkey(key)

View File

@ -10,10 +10,18 @@ import Foundation
public extension MVMCoreGetterUtility {
class func fequal(a: Float ,b: Float) -> Bool {
return (abs((a) - (b)) < Float.ulpOfOne)
return fequalwiththreshold(a, b, Float.ulpOfOne)
}
class func cgfequal(_ a: CGFloat ,_ b: CGFloat) -> Bool {
return (abs((a) - (b)) < CGFloat.ulpOfOne)
return cgfequalwiththreshold(a, b, CGFloat.ulpOfOne)
}
class func fequalwiththreshold(_ a: Float,_ b: Float,_ c: Float) -> Bool {
return (abs((a) - (b)) < c)
}
class func cgfequalwiththreshold(_ a: CGFloat ,_ b: CGFloat,_ c: CGFloat) -> Bool {
return (abs((a) - (b)) < c)
}
}