We have use SDWebImage instead of AFNetworking to handle memory warning.
You can find swift code from below link.
here is below code:
[imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
// Some time may possible that this cause memory warning than use below code to overcome(This causes less memory warning than AFNetworking.)
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
[[[SDWebImageManager sharedManager] imageCache] clearDisk];
[[[SDWebImageManager sharedManager] imageCache] clearMemory];
}