Are all the extension, You don't need to import any classes
let randomColor = UIColor.randomColor()
let hexColor = UIColor.randomColor("#ffffff")
let rgb = UIColor.red.getRGBWithColor()
Swifts Tools
Are all the extension, You don't need to import any classes
let randomColor = UIColor.randomColor()
let hexColor = UIColor.randomColor("#ffffff")
let rgb = UIColor.red.getRGBWithColor()
To note here, need to cooperate with OC, we create a OC any file, Xcode will prompt us to generate a bridge - Bridging - the Header file XXX. H, here we need # import < CommonCrypto/CommonCrypto.h>, Command + B compiler through. Complete
Now you can use it easily
let md5 = "password".getMd5()
let sha1 = "password".getSha1()
let redImage = UIImage.imageWithColor(color: .red)
let customSizeImage = UIImage(named: "image").imageWithNewSize(size: mySize)
let cycleImage = UIImage(named: "image")?.clipToCycle(withBorder: 1, withColor: .red)
"alert like android toast"
view.showToast(withString: "I'm a toast", 1.5, 2.5)
let cachePath = cacheDir()
let documentPath = documentDir()
let tempPath = tempDir()
getDirectoryCache(path) { (size) in
// get all the file sizes through the path
}
cleanFolder(path) { (completed) in
// remove all files by the path
}
"Refresh For TableView , CollectionView O ScrollView"
let refresh = JSRefreshControl()
tableView.addSubview(refresh)
refresh.addTarget(self, action: #selector(your function), for: .valueChanged)
"now you can to refresh"
refresh.beginRefreshing()
refresh.endRefreshing()
"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" for test
JSDownLoadManager.shareInstance.downLoadWithInfo(urlName: url, statusType: { (status: JSDownLoadState) in
//
}, progresesType: { (progress) in
//
}, totalSize: { (fileSize) in
//
}) { (filePath) in
//
}
// JSDownLoadManager.shareInstance.resumeWithURL(url: url)
// JSDownLoadManager.shareInstance.pauseWithURL(url: url!)
// JSDownLoadManager.shareInstance.cancelWithURL(url: url!)
// JSDownLoadManager.shareInstance.cancelAndCleanWithURl(url: url!)
// JSDownLoadManager.shareInstance.cancelAll()
There will be more, if i have time