Loadimageview to swift
This commit is contained in:
parent
11a96e6120
commit
85bbf028cf
@ -140,6 +140,8 @@
|
|||||||
AFFCFA661FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
AFFCFA661FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
AFFCFA671FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */; };
|
AFFCFA671FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */; };
|
||||||
AFFCFA681FCCC0D700FD0730 /* MVMCoreLoadingViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA641FCCC0D600FD0730 /* MVMCoreLoadingViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
AFFCFA681FCCC0D700FD0730 /* MVMCoreLoadingViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA641FCCC0D600FD0730 /* MVMCoreLoadingViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
D282AAB62240085300C46919 /* MVMCoreGetterUtility+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB52240085300C46919 /* MVMCoreGetterUtility+Extension.swift */; };
|
||||||
|
D282AAB82240342D00C46919 /* NSNumber+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB72240342D00C46919 /* NSNumber+Extension.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@ -270,6 +272,8 @@
|
|||||||
AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingOverlayHandler.h; sourceTree = "<group>"; };
|
AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingOverlayHandler.h; sourceTree = "<group>"; };
|
||||||
AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreLoadingOverlayHandler.m; sourceTree = "<group>"; };
|
AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreLoadingOverlayHandler.m; sourceTree = "<group>"; };
|
||||||
AFFCFA641FCCC0D600FD0730 /* MVMCoreLoadingViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingViewControllerProtocol.h; sourceTree = "<group>"; };
|
AFFCFA641FCCC0D600FD0730 /* MVMCoreLoadingViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingViewControllerProtocol.h; sourceTree = "<group>"; };
|
||||||
|
D282AAB52240085300C46919 /* MVMCoreGetterUtility+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreGetterUtility+Extension.swift"; sourceTree = "<group>"; };
|
||||||
|
D282AAB72240342D00C46919 /* NSNumber+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSNumber+Extension.swift"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -342,6 +346,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
01DF561321F90ADC00CC099B /* Dictionary+MFConvenience.swift */,
|
01DF561321F90ADC00CC099B /* Dictionary+MFConvenience.swift */,
|
||||||
|
D282AAB72240342D00C46919 /* NSNumber+Extension.swift */,
|
||||||
8876D5DA1FB50AB000EB2E3D /* NSArray+MFConvenience.h */,
|
8876D5DA1FB50AB000EB2E3D /* NSArray+MFConvenience.h */,
|
||||||
8876D5DB1FB50AB000EB2E3D /* NSArray+MFConvenience.m */,
|
8876D5DB1FB50AB000EB2E3D /* NSArray+MFConvenience.m */,
|
||||||
8876D5DC1FB50AB000EB2E3D /* NSDecimalNumber+MFConvenience.h */,
|
8876D5DC1FB50AB000EB2E3D /* NSDecimalNumber+MFConvenience.h */,
|
||||||
@ -515,6 +520,7 @@
|
|||||||
AFBB96AD1FBA3B590008D868 /* MVMCoreDispatchUtility.m */,
|
AFBB96AD1FBA3B590008D868 /* MVMCoreDispatchUtility.m */,
|
||||||
AFBB96AE1FBA3B590008D868 /* MVMCoreGetterUtility.h */,
|
AFBB96AE1FBA3B590008D868 /* MVMCoreGetterUtility.h */,
|
||||||
AFBB96AF1FBA3B590008D868 /* MVMCoreGetterUtility.m */,
|
AFBB96AF1FBA3B590008D868 /* MVMCoreGetterUtility.m */,
|
||||||
|
D282AAB52240085300C46919 /* MVMCoreGetterUtility+Extension.swift */,
|
||||||
AF43A5851FBB67D6008E9347 /* MVMCoreActionUtility.h */,
|
AF43A5851FBB67D6008E9347 /* MVMCoreActionUtility.h */,
|
||||||
AF43A5861FBB67D6008E9347 /* MVMCoreActionUtility.m */,
|
AF43A5861FBB67D6008E9347 /* MVMCoreActionUtility.m */,
|
||||||
);
|
);
|
||||||
@ -768,6 +774,7 @@
|
|||||||
AFBB96BA1FBA3CEC0008D868 /* MVMCoreActionHandler.m in Sources */,
|
AFBB96BA1FBA3CEC0008D868 /* MVMCoreActionHandler.m in Sources */,
|
||||||
AFBB96ED1FBA4A260008D868 /* MFHardCodedServerResponse.m in Sources */,
|
AFBB96ED1FBA4A260008D868 /* MFHardCodedServerResponse.m in Sources */,
|
||||||
AF43A74D1FC6109F008E9347 /* MVMCoreSessionObject.m in Sources */,
|
AF43A74D1FC6109F008E9347 /* MVMCoreSessionObject.m in Sources */,
|
||||||
|
D282AAB62240085300C46919 /* MVMCoreGetterUtility+Extension.swift in Sources */,
|
||||||
AFBB965F1FBA3A570008D868 /* MFFreebeeOperation.m in Sources */,
|
AFBB965F1FBA3A570008D868 /* MFFreebeeOperation.m in Sources */,
|
||||||
AFBB96901FBA3A9A0008D868 /* MVMCoreNavigationObject.m in Sources */,
|
AFBB96901FBA3A9A0008D868 /* MVMCoreNavigationObject.m in Sources */,
|
||||||
AFBB96A61FBA3A9A0008D868 /* MVMCoreTopAlertOperation.m in Sources */,
|
AFBB96A61FBA3A9A0008D868 /* MVMCoreTopAlertOperation.m in Sources */,
|
||||||
@ -804,6 +811,7 @@
|
|||||||
AF43A5841FBB66DE008E9347 /* MVMCoreConstants.m in Sources */,
|
AF43A5841FBB66DE008E9347 /* MVMCoreConstants.m in Sources */,
|
||||||
AFBB966A1FBA3A570008D868 /* MVMCoreLoadRequestOperation.m in Sources */,
|
AFBB966A1FBA3A570008D868 /* MVMCoreLoadRequestOperation.m in Sources */,
|
||||||
8876D5F31FB50AB000EB2E3D /* UIFont+MFSpacing.m in Sources */,
|
8876D5F31FB50AB000EB2E3D /* UIFont+MFSpacing.m in Sources */,
|
||||||
|
D282AAB82240342D00C46919 /* NSNumber+Extension.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
15
MVMCore/MVMCore/Categories/NSNumber+Extension.swift
Normal file
15
MVMCore/MVMCore/Categories/NSNumber+Extension.swift
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// NSNumber+Extension.swift
|
||||||
|
// MVMCore
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 3/18/19.
|
||||||
|
// Copyright © 2019 myverizon. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public extension NSNumber {
|
||||||
|
public func cgfloat() -> CGFloat {
|
||||||
|
return CGFloat(doubleValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -118,12 +118,12 @@ typedef void(^MVMCoreGetImageBlock)(UIImage * _Nullable, NSData * _Nullable, BOO
|
|||||||
// Most cases only need to provide the width. If both are provided and the aspect ratio is different from the images, it will center the image.
|
// Most cases only need to provide the width. If both are provided and the aspect ratio is different from the images, it will center the image.
|
||||||
// In the future, may need to use align for the shop flow.
|
// In the future, may need to use align for the shop flow.
|
||||||
// localFallbackImageName: should be the name of a local file to use in case of failure to download.
|
// localFallbackImageName: should be the name of a local file to use in case of failure to download.
|
||||||
- (void)getImage:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
- (void)getImage:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
||||||
- (void)getImage:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
- (void)getImage:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
||||||
- (void)getGif:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
- (void)getGif:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
||||||
|
|
||||||
// Gets a cropped version of the requested image. Similar to the method above, but you can specify the final rect
|
// Gets a cropped version of the requested image. Similar to the method above, but you can specify the final rect
|
||||||
- (void)getCroppedImage:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 finalRect:(CGRect)finalRect flipImage:(BOOL)flipImage localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
- (void)getCroppedImage:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 finalRect:(CGRect)finalRect flipImage:(BOOL)flipImage localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler;
|
||||||
|
|
||||||
// Gets an image from the cache.
|
// Gets an image from the cache.
|
||||||
- (nullable UIImage *)getCachedImageWithName:(nonnull NSString *)imageName;
|
- (nullable UIImage *)getCachedImageWithName:(nonnull NSString *)imageName;
|
||||||
|
|||||||
@ -453,15 +453,15 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
|||||||
return [components URL];
|
return [components URL];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)getImage:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
- (void)getImage:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
||||||
[self getImage:pathOrName useWidth:useWidth widthForS7:widthForS7 useHeight:useHeight heightForS7:heightForS7 format:nil localFallbackImageName:fallbackImageName completionHandler:completionHandler];
|
[self getImage:pathOrName useWidth:useWidth widthForS7:widthForS7 useHeight:useHeight heightForS7:heightForS7 format:nil localFallbackImageName:fallbackImageName completionHandler:completionHandler];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)getImage:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
- (void)getImage:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
||||||
[self getImage:pathOrName useWidth:useWidth widthForS7:widthForS7 useHeight:useHeight heightForS7:heightForS7 format:format finalRect:CGRectNull flipImage:NO localFallbackImageName:fallbackImageName completionHandler:completionHandler];
|
[self getImage:pathOrName useWidth:useWidth widthForS7:widthForS7 useHeight:useHeight heightForS7:heightForS7 format:format finalRect:CGRectNull flipImage:NO localFallbackImageName:fallbackImageName completionHandler:completionHandler];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)getGif:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
- (void)getGif:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
||||||
|
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
NSData *imageData = nil;
|
NSData *imageData = nil;
|
||||||
@ -488,12 +488,12 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)getCroppedImage:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 finalRect:(CGRect)finalRect flipImage:(BOOL)flip localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
- (void)getCroppedImage:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 finalRect:(CGRect)finalRect flipImage:(BOOL)flip localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
||||||
|
|
||||||
[self getImage:pathOrName useWidth:useWidth widthForS7:widthForS7 useHeight:useHeight heightForS7:heightForS7 format:nil finalRect:finalRect flipImage:flip localFallbackImageName:fallbackImageName completionHandler:completionHandler];
|
[self getImage:pathOrName useWidth:useWidth widthForS7:widthForS7 useHeight:useHeight heightForS7:heightForS7 format:nil finalRect:finalRect flipImage:flip localFallbackImageName:fallbackImageName completionHandler:completionHandler];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)getImage:(nonnull NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format finalRect:(CGRect)finalRect flipImage:(BOOL)flip localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
- (void)getImage:(nullable NSString *)pathOrName useWidth:(BOOL)useWidth widthForS7:(NSInteger)widthForS7 useHeight:(BOOL)useHeight heightForS7:(NSInteger)heightForS7 format:(nullable NSString *)format finalRect:(CGRect)finalRect flipImage:(BOOL)flip localFallbackImageName:(nullable NSString *)fallbackImageName completionHandler:(nonnull MVMCoreGetImageBlock)completionHandler {
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
UIImage *image = nil;
|
UIImage *image = nil;
|
||||||
if (pathOrName.length > 0) {
|
if (pathOrName.length > 0) {
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// MVMCoreGetterUtility+Extension.swift
|
||||||
|
// MVMCore
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 3/18/19.
|
||||||
|
// Copyright © 2019 myverizon. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public extension MVMCoreGetterUtility {
|
||||||
|
public class func fequal(a: Float ,b: Float) -> Bool {
|
||||||
|
return (abs((a) - (b)) < Float.ulpOfOne)
|
||||||
|
}
|
||||||
|
|
||||||
|
public class func cgfequal(_ a: CGFloat ,_ b: CGFloat) -> Bool {
|
||||||
|
return (abs((a) - (b)) < CGFloat.ulpOfOne)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user