Skip to content

Latest commit

 

History

History
72 lines (43 loc) · 2.05 KB

README.md

File metadata and controls

72 lines (43 loc) · 2.05 KB

GHImageMemoryCostDetector

an easy way to show the memory cost in your UIImageView, as a reference, to optimise app's memory usage.

Swift Version Swift Version Plaform

Installation

Simply add Source folder with files to your project.

Usage example

image

image

You can find example projects here

Start

You just only initialize in your appDelegate.m When your App are launching. Objective-C usage

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [UIImageView showMemoryCost];
    return YES;
}

Swift usage

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        UIImageView.showMemoryCost()
        return true
    }

And then, you can all the imageView memory usage in every imageView.

Support

UIImageView and it's subclass, like: SDAnimatedImageView.

Performance

GHImageMemoryCostDetector just add a lightweight text layer in your original imageView.

The total time consuming of UIImageView image set event for 20000 times:

image

Testing Environment: iPhone X

System Version: iOS 13.4.1

Unit of Time : s

Features

  • This framework only contains two files

    UIImageView+MemDetector.h

    UIImageView+MemDetector.m

  • Easy to use and uninstall.

  • At release mode, there will be no more any memory detection in your UIImageView.