I using the LJWebImage sample project, Which,I found from github on the following link https://github.com/likumb/LJWebImage. Project,similar to SDWebImage.I am successfully imported the sample project into my main project.I am using collectionView to populating the image from plist which contain number of url links.I am trying to shuffle the plist Array when collectionView loaded.I am using the following code to populate collectionView.
import UIKit
class AppInfo: NSObject {
var icon: String?
class func appInfo() -> NSArray {
let path = Bundle.main.path(forResource: "apps", ofType: "plist");
let apps = NSArray(contentsOfFile: path!)!
let appInfos = NSMutableArray()
// I am trying to shuffle the array using the following random function
///////////////////////////////////////////////////////////////////////
let randomIndex = Int(arc4random_uniform(UInt32(apps.count)))
print(apps[randomIndex])
/////////////////////////////////////////////////////////////////
for obj in apps{
let appInfo = AppInfo()
appInfo.setValuesForKeys(obj as! [String : AnyObject])
appInfos.add(appInfo)
}
return appInfos
}
}