waring fix

This commit is contained in:
Pfeil, Scott Robert 2019-04-15 13:08:20 -04:00
parent f1d884227f
commit a65edbc5df
5 changed files with 23 additions and 23 deletions

View File

@ -11,7 +11,7 @@ import Foundation
public extension Dictionary { public extension Dictionary {
/// Returns a Dictionary using the specified chain. An empty dictionary is returned if a dictionary for the chain does not exist /// Returns a Dictionary using the specified chain. An empty dictionary is returned if a dictionary for the chain does not exist
public func dictionaryWithChainOfKeysOrIndexes(_ keysOrIndexes: [Any]) -> [String : Any] { func dictionaryWithChainOfKeysOrIndexes(_ keysOrIndexes: [Any]) -> [String : Any] {
guard let dictionary = optionalDictionaryWithChainOfKeysOrIndexes(keysOrIndexes) else { guard let dictionary = optionalDictionaryWithChainOfKeysOrIndexes(keysOrIndexes) else {
return [:] return [:]
@ -20,18 +20,18 @@ public extension Dictionary {
} }
/// Returns an optional Dictionary using the specified chain. Returns nil if a dictionary for the chain does not exist /// Returns an optional Dictionary using the specified chain. Returns nil if a dictionary for the chain does not exist
public func optionalDictionaryWithChainOfKeysOrIndexes (_ keysOrIndexes: [Any]) -> [String : Any]? { func optionalDictionaryWithChainOfKeysOrIndexes (_ keysOrIndexes: [Any]) -> [String : Any]? {
return objectChainOfKeysOrIndexes(keysOrIndexes) as? [String: Any] return objectChainOfKeysOrIndexes(keysOrIndexes) as? [String: Any]
} }
public func optionalDictionaryForKey(_ key: String) -> [String : Any]? { func optionalDictionaryForKey(_ key: String) -> [String : Any]? {
return objectChainOfKeysOrIndexes([key]) as? [String: Any] return objectChainOfKeysOrIndexes([key]) as? [String: Any]
} }
/// Returns a String using the specified chain. An empty string is returned if a string for the chain does not exist /// Returns a String using the specified chain. An empty string is returned if a string for the chain does not exist
public func stringWithChainOfKeysOrIndexes(_ keysOrIndexes:[Any]) -> String { func stringWithChainOfKeysOrIndexes(_ keysOrIndexes:[Any]) -> String {
guard let string = objectChainOfKeysOrIndexes(keysOrIndexes) as? String else { guard let string = objectChainOfKeysOrIndexes(keysOrIndexes) as? String else {
return "" return ""
@ -39,12 +39,12 @@ public extension Dictionary {
return string return string
} }
public func stringOptionalWithChainOfKeysOrIndexes(_ keysOrIndexes:[Any]) -> String? { func stringOptionalWithChainOfKeysOrIndexes(_ keysOrIndexes:[Any]) -> String? {
return objectChainOfKeysOrIndexes(keysOrIndexes) as? String return objectChainOfKeysOrIndexes(keysOrIndexes) as? String
} }
/// Returns an Array using the specified chain. Returns an empty array if an array for the chain does not exist /// Returns an Array using the specified chain. Returns an empty array if an array for the chain does not exist
public func arrayForChainOfKeysOrIndexes(_ keysOrIndexes: [Any]) -> [Any] { func arrayForChainOfKeysOrIndexes(_ keysOrIndexes: [Any]) -> [Any] {
guard let array = objectChainOfKeysOrIndexes(keysOrIndexes) as? [Any] else { guard let array = objectChainOfKeysOrIndexes(keysOrIndexes) as? [Any] else {
return [] return []
@ -53,31 +53,31 @@ public extension Dictionary {
} }
/// Returns a Dictionary after looking up the specified key. An empty dictionary is returned if a dictionary for the key does not exist /// Returns a Dictionary after looking up the specified key. An empty dictionary is returned if a dictionary for the key does not exist
public func dictionaryForKey(_ key : String) -> [String : Any] { func dictionaryForKey(_ key : String) -> [String : Any] {
return dictionaryWithChainOfKeysOrIndexes([key]) return dictionaryWithChainOfKeysOrIndexes([key])
} }
/// Returns a String after looking up the specified key. An empty string will be returned if a string for the key does not exist /// Returns a String after looking up the specified key. An empty string will be returned if a string for the key does not exist
public func stringForkey(_ key: String) -> String { func stringForkey(_ key: String) -> String {
return stringWithChainOfKeysOrIndexes([key]) return stringWithChainOfKeysOrIndexes([key])
} }
/// Returns a String after looking up the specified key. Nil will be returned if a string for the key does not exist /// Returns a String after looking up the specified key. Nil will be returned if a string for the key does not exist
public func optionalStringForKey(_ key: String) -> String? { func optionalStringForKey(_ key: String) -> String? {
return objectChainOfKeysOrIndexes([key]) as? String return objectChainOfKeysOrIndexes([key]) as? String
} }
/// Returns an Array after looking up the specified key. An empty array will be returned if an array for the key does not exist /// Returns an Array after looking up the specified key. An empty array will be returned if an array for the key does not exist
public func arrayForKey(_ key : String) -> [Any] { func arrayForKey(_ key : String) -> [Any] {
return arrayForChainOfKeysOrIndexes([key]) return arrayForChainOfKeysOrIndexes([key])
} }
/// Return a Bool after looking up the specified key. This will return false if the key does not exist /// Return a Bool after looking up the specified key. This will return false if the key does not exist
public func boolForKey(_ key : String) -> Bool { func boolForKey(_ key : String) -> Bool {
guard let bool = objectChainOfKeysOrIndexes([key]) as? Bool else { guard let bool = objectChainOfKeysOrIndexes([key]) as? Bool else {
return false return false
@ -86,7 +86,7 @@ public extension Dictionary {
} }
/// Return a Bool after looking up the specified key. This will return false if the key does not exist /// Return a Bool after looking up the specified key. This will return false if the key does not exist
public func optionalBoolForKey(_ key : String) -> Bool? { func optionalBoolForKey(_ key : String) -> Bool? {
guard let bool = objectChainOfKeysOrIndexes([key]) as? Bool else { guard let bool = objectChainOfKeysOrIndexes([key]) as? Bool else {
return nil return nil
@ -94,7 +94,7 @@ public extension Dictionary {
return bool return bool
} }
public func lenientBoolForKey(_ key: String) -> Bool { func lenientBoolForKey(_ key: String) -> Bool {
guard let key = key as? Key, let object = self[key] else { guard let key = key as? Key, let object = self[key] else {
return false return false
} }
@ -106,7 +106,7 @@ public extension Dictionary {
return false return false
} }
public func boolForChainOfKeysOrIndexes(_ keysOrIndexes:[Any])-> Bool { func boolForChainOfKeysOrIndexes(_ keysOrIndexes:[Any])-> Bool {
guard let bool = objectChainOfKeysOrIndexes(keysOrIndexes) as? Bool else { guard let bool = objectChainOfKeysOrIndexes(keysOrIndexes) as? Bool else {
return false return false
} }
@ -114,7 +114,7 @@ public extension Dictionary {
} }
/// Return a float from a string created by looking up the specified key. This will return 0.0 if the key does not exist /// Return a float from a string created by looking up the specified key. This will return 0.0 if the key does not exist
public func floatForKey(_ key: String) -> Float { func floatForKey(_ key: String) -> Float {
guard let floatValue = objectChainOfKeysOrIndexes([key]) as? Float else { guard let floatValue = objectChainOfKeysOrIndexes([key]) as? Float else {
return 0.0 return 0.0
@ -123,7 +123,7 @@ public extension Dictionary {
return floatValue return floatValue
} }
public func floatFromStringForKey(_ key:String) -> Float { func floatFromStringForKey(_ key:String) -> Float {
let stringValue = stringForkey(key) let stringValue = stringForkey(key)
@ -135,7 +135,7 @@ public extension Dictionary {
} }
public func int32ForKey(_ key:String) -> Int32 { func int32ForKey(_ key:String) -> Int32 {
guard let intValue = objectChainOfKeysOrIndexes([key]) as? Int32 else { guard let intValue = objectChainOfKeysOrIndexes([key]) as? Int32 else {
return 0 return 0

View File

@ -9,7 +9,7 @@
import Foundation import Foundation
public extension NSNumber { public extension NSNumber {
public func cgfloat() -> CGFloat { func cgfloat() -> CGFloat {
return CGFloat(doubleValue) return CGFloat(doubleValue)
} }
} }

View File

@ -24,9 +24,9 @@
+ (void)displayViewController:(nonnull UIViewController <MVMCoreViewControllerProtocol> *)viewController forLoadObject:(nullable MVMCoreLoadObject *)loadObject presentationDelegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock; + (void)displayViewController:(nonnull UIViewController <MVMCoreViewControllerProtocol> *)viewController forLoadObject:(nullable MVMCoreLoadObject *)loadObject presentationDelegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock;
// returns if the class is not the same or a subclass of the other class. Can pass throw an exception as well // returns if the class is not the same or a subclass of the other class. Can pass throw an exception as well
+ (BOOL)classIsInstanceTypeOfClass:(Class)theClass otherClass:(Class)otherClass throwException:(BOOL)throwException; + (BOOL)classIsInstanceTypeOfClass:(nonnull Class)theClass otherClass:(nonnull Class)otherClass throwException:(BOOL)throwException;
// Calls the above function with throw exception yes if the object is not nil. Returns the object. Convenience function for one liner in initializer. // Calls the above function with throw exception yes if the object is not nil. Returns the object. Convenience function for one liner in initializer.
+ (id)initializerClassCheck:(nullable NSObject *)object classToVerify:(Class)classToVerify; + (nonnull id)initializerClassCheck:(nullable NSObject *)object classToVerify:(nonnull Class)classToVerify;
@end @end

View File

@ -19,6 +19,6 @@
+ (void)performSyncBlockInBackground:(nonnull void (^)(void))block; + (void)performSyncBlockInBackground:(nonnull void (^)(void))block;
/// Ensures the block is peformed on the same *labeled* dispatch queue. The queue *must* be previously initialized with a unique label. /// Ensures the block is peformed on the same *labeled* dispatch queue. The queue *must* be previously initialized with a unique label.
+ (void)performSyncBlock:(nonnull void (^)(void))block onQueue:(dispatch_queue_t)queue; + (void)performSyncBlock:(nonnull void (^)(void))block onQueue:(nonnull dispatch_queue_t)queue;
@end @end

View File

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